Нужно передать переменную vyvod в функцию temp
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;
}
}
}
vyvodне объявлена. должно бытьstring vyvod = .... и строка с Substring не компилируется. – Dec 26 '15 at 20:31