C# Winform 获取天气情况
2024-10-12 15:42:47
WebServices(http://www.webxml.com.cn/WebServices/WeatherWebService.asmx)来实现天气预报,该天气预报 Web 服务,数据来源于中国气象局 http://www.cma.gov.cn/ ,数据每2.5小时左右自动更新一次,准确可靠。包括 340 多个中国主要城市和 60 多个国外主要城市三日内的天气预报数据。
private void buttonWeather_Click_1(object sender, EventArgs e)
{
Weather.WeatherWebServiceSoapClient w = new Weather.WeatherWebServiceSoapClient("WeatherWebServiceSoap");
//把webservice当做一个类来操作
string[] s = new string[];//声明string数组存放返回结果
string city = this.textBox1.Text.Trim();//获得文本框录入的查询城市
s = w.getWeatherbyCityName(city);
//以文本框内容为变量实现方法getWeatherbyCityName
if (s[] == "")
{
MessageBox.Show("暂时不支持您查询的城市");
}
else
{
pictureBox1.Image = Image.FromFile(@"d:\image\" + s[] + "");
this.label4.Text =s[]+" "+s[];
textBox2.Text = s[];
} }
最新文章
- exportfs 入门/ 错误
- spring3 DI基础
- Groovy 转换JSON和生产JSON
- 加州大学伯克利分校Stat2.2x Probability 概率初步学习笔记: Final
- c++ map 的基本操作
- C library function - freopen()
- 学习jsp(1)
- python基础(set)补充
- Linux段管理,BSS段,data段,.rodata段,text段
- sphinx cmd command
- (转)WebSphere MQ基础命令
- oracle to_date 函数
- 【alpha阶段】第八次Scrum Meeting
- Flex布局【弹性布局】学习
- HTTPS IP直连问题小结
- 20165321 学习基础与C语言学习心得
- Mycat入门配置_读写分离配置
- POJ1807&;&;1276
- Mac环境下WingIDE切换python版本
- BZOJ3243 NOI2013向量内积(随机化)
热门文章
- 9 I/O复用
- ActionScript基本语法讲解
- sublime text3使用心得及个人配置 sublime常用快捷键大全
- Request/Server的相关topic
- POJ 1548 Robots (Dilworth)
- POJ 2153 Rank List (map映射)
- 关于iOS7 上下黑条解决办法
- Codeforces Round #260 (Div. 2) A~C
- HBase保存的各个字段意义解释
- BestCoder 1st Anniversary($) 1003 Sequence