• 大小: 185KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: C#
  • 标签: C#  WebService  天气预报  

资源简介

参照这个网址http://zhangkui.blog.51cto.com/1796259/497324。实现C#调用WebService实现天气预报获取。完全能用。自己有编译通过。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(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];
            }  
 
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        460  2007-03-23 13:23  WindowsFormsApplication2\image\0.gif

     文件        458  2007-03-23 13:23  WindowsFormsApplication2\image\1.gif

     文件        404  2007-03-23 23:49  WindowsFormsApplication2\image\10.gif

     文件        453  2007-03-23 23:49  WindowsFormsApplication2\image\11.gif

     文件        460  2007-03-23 23:50  WindowsFormsApplication2\image\12.gif

     文件        450  2007-03-23 23:50  WindowsFormsApplication2\image\13.gif

     文件        440  2007-03-23 18:30  WindowsFormsApplication2\image\14.gif

     文件        436  2007-03-23 18:30  WindowsFormsApplication2\image\15.gif

     文件        453  2007-03-23 13:23  WindowsFormsApplication2\image\16.gif

     文件        458  2007-03-23 23:50  WindowsFormsApplication2\image\17.gif

     文件        366  2007-03-23 18:30  WindowsFormsApplication2\image\18.gif

     文件        438  2007-03-23 23:50  WindowsFormsApplication2\image\19.gif

     文件        420  2007-03-23 13:23  WindowsFormsApplication2\image\2.gif

     文件        451  2007-03-23 23:51  WindowsFormsApplication2\image\20.gif

     文件        434  2007-03-23 23:51  WindowsFormsApplication2\image\21.gif

     文件        441  2007-03-23 23:51  WindowsFormsApplication2\image\22.gif

     文件        459  2007-03-23 23:51  WindowsFormsApplication2\image\23.gif

     文件        450  2007-03-23 23:51  WindowsFormsApplication2\image\24.gif

     文件        467  2007-03-23 23:51  WindowsFormsApplication2\image\25.gif

     文件        429  2007-03-23 23:51  WindowsFormsApplication2\image\26.gif

     文件        442  2007-03-23 23:51  WindowsFormsApplication2\image\27.gif

     文件        460  2007-03-23 23:51  WindowsFormsApplication2\image\28.gif

     文件        556  2007-03-24 00:08  WindowsFormsApplication2\image\29.gif

     文件        453  2007-03-23 13:23  WindowsFormsApplication2\image\3.gif

     文件       1048  2007-03-24 00:08  WindowsFormsApplication2\image\30.gif

     文件       1069  2007-03-24 00:08  WindowsFormsApplication2\image\31.gif

     文件        463  2007-03-23 18:30  WindowsFormsApplication2\image\4.gif

     文件        465  2007-03-23 23:49  WindowsFormsApplication2\image\5.gif

     文件        471  2007-03-23 13:23  WindowsFormsApplication2\image\6.gif

     文件        417  2007-03-23 13:23  WindowsFormsApplication2\image\7.gif

............此处省略131个文件信息

评论

共有 条评论