private void button1_Click(object sender, EventArgs e)
{
weathertest.Weather.WeatherWebServiceSoapClient w = newweathertest.Weather.WeatherWebServiceSoapClient("WeatherWebServiceSoap");
//把webservice當做一個類來操作
string[] s = new string[23];//聲明一個string數組存放其傳回的結果
string c = this.textBox2.Text.Trim();//獲得文本框2的内容
s = w.getWeatherbyCityName(c);
//以文本框内容為變量實作方法getWeatherbyCityName
if (s[8] == "")
{
MessageBox.Show("暫時不支援您查詢的城市");
}
else
{
// pictureBox1.Image = Image.FromFile(@"d:/image/" + s[8] + "");
//将相應的值賦給相應的文本顯示出來
textBox1.Text = s[0];
textBox3.Text = s[1];
textBox4.Text = s[2];
textBox5.Text = s[4];
textBox6.Text = s[5];
textBox7.Text = s[6];
textBox8.Text = s[7];
textBox9.Text = s[10];
textBox10.Text = s[12];
textBox11.Text = s[13];
textBox12.Text = s[14];
textBox13.Text = s[17];
textBox14.Text = s[18];
textBox15.Text = s[19];
}
}