private void Page_Load(pengirim objek, System.EventArgs e)
{
WebRequest wreq=WebRequest.Create(" http://weather.yahoo.com/forecast/CHXX0133_c.html ");
HttpWebResponse wresp=(HttpWebResponse)wreq.GetResponse();
string HTML ="";
Aliran s=wresp.GetResponseStream();
StreamReader objReader = StreamReader baru(s,System.Text.Encoding.GetEncoding("GB2312"));
string sGaris = "";
ke dalam saya = 0;
sementara (sLine!=null)
{
saya++;
sLine = objReader.ReadLine();
jika (sGaris!=null)
HTML += sGaris;
}
Suhu string= "";
int mulai,berhenti;
// string aa="<div class="prakiraan malam lima hari" style="border:none;">";
//string aa="<div class="prakiraan lima hari" style="border:none;">";
string aa="<tabel><th>Hari ini</th>";
mulai = HTML.IndexOf(aa,0,HTML.Panjang);
stop = HTML.IndexOf("</table>",mulai)+8;
temp = HTML.Substring(mulai, berhenti - mulai);
this.Weather2.Text=temp;
string cc="<tr class="judul"><td>";
//
int aa1 =temp.IndexOf(cc,0,temp.Panjang);
int bb=temp.IndexOf("</td>",aa1);
this.Weather2.Text=temp.Substring(aa1, bb - aa1).ToString();
string ee="<tr class="temps">";
int aa2 =temp.IndexOf(ee,0,temp.Length);
int bb1=temp.IndexOf("</td>",aa2);
this.Label1.Text=temp.Substring(aa2, bb1 - aa2).ToString();
// 在此处放置用户代码以初始化页面
}