You need to pass the vyvod variable to the temp function.
using System; using System.Collections.Generic; using System.Windows.Forms; using System.Text; using System.Threading; using xNet; namespace pogoda { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } public void Button1Click(object sender, EventArgs e) { var request = new HttpRequest(); request.AllowAutoRedirect = true; request.CharacterSet = Encoding.GetEncoding("UTF-8"); request.UserAgent = "Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25"; string vyvod = request.Get("http://pogoda.tut.by/city/minsk").ToString(); // Data is geting. start multithear Thread th = new Thread(temp); th.Start(); } public void MainFormLoad(object sender, EventArgs e) { } public void temp(){ string temp = vyvod.Substring("<span class=\"temp-i\">", "</span>"); temp = temp.Replace("°", "°"); label2.Text = temp; } } }
vyvodnot declared. must bestring vyvod = ...and the string with Substring is not compiled. - PashaPash ♦