http://zhangkui.blog.51cto.com/1796259/497324
- private void button1_Click_1(object sender, EventArgs e)
- {
- Weather.WeatherWebServiceSoapClient w = new Weather.WeatherWebServiceSoapClient("WeatherWebServiceSoap");
- //把webservice当做一个类来操作
- string[] s = new string[23];//声明string数组存放返回结果
- string city = this.textBox1.Text.Trim();//获得文本框录入的查询城市
- s = w.getWeatherbyCityName(city);
- //以文本框内容为变量实现方法getWeatherbyCityName
- if (s[8] == "")
- {
- MessageBox.Show("暂时不支持您查询的城市");
- }
- else
- {
- pictureBox1.Image = Image.FromFile(@"d:\image\" + s[8] + "");
- this.label4.Text =s[1]+" "+s[6];
- textBox2.Text = s[10];
- }
- }