设为首页 加入收藏

TOP

查询天气的服务引用,有类似的吧;
2019-09-17 16:50:14 】 浏览:11
Tags:查询 天气 服务 引用 似的

首先要引用这个服务,http://www.webxml.com.cn/Webservices/WeatherWebService.asmx

添加服务和引用---->转到---->高级---->添加WEB应用---->添加引用       到此OK。                           1个text,1个button,2个lable

private void btn_search_Click(object sender, EventArgs e)
{
cn.com.webxml.www.WeatherWebService w = new cn.com.webxml.www.WeatherWebService();
string[] s = new string[23];
string city = text_city.Text.Trim();
s = w.getWeatherbyCityName(city);
if(s[8]=="")
{
MessageBox.Show("暂不支持查询的城市");
}
else
{
label_gaikuang.Text = s[1] + "" + s[6];
label_shikuang.Text = s[10];
MessageBox.Show(s[3]+"\n\r"+s[4]+s[5]+s[7]+s[8]+s[9]);
}
}

 w.getWeatherbyCityName(city);    返回的是一个以为数组,有兴趣的话可以看看里面都是什么内容;

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C# 测试网络速度例子 下一篇写一个TimeUI显示的函数,上代码

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目