A reliable weather forecast Web Server:
Http://www.ayandy.com/
Getweatherbycityname
Obtain weather conditions based on the city name. This service data comes from the data of the China Meteorological Administration, which is updated in real time and accurate and reliable. The call method is as follows: Enter the parameter thecityname (Chinese name of the city, for example, Shenzhen or Beijing; thedayflag indicates the current day (1), Tomorrow (2), or the next day (3 ), you can query the weather conditions in the next three days. The returned data is a one-dimensional value in string [7]. There are seven elements, from [1] to [6], indicating the city, weather, and temperature respectively, wind direction, date, and weather icon address. Author QQ: 15244833 welcome to communicate with friends :)
Supports data from cities and the China Meteorological Administration.
C #Code:
Using system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. text;
Using system. Windows. forms;
namespace windowsapplication1
{< br> Public partial class form1: Form
{< br> Public form1 ()
{< br> initializecomponent ();
}
private void form1_load (Object sender, eventargs e)
{< br> string [] Cs;
cs = new COM. ayandy. www. service (). getsupportprovince ();
int16 length;
length = convert. toint16 (CS [0]);
For (INT I = 1; I <= length; I ++)
This. combobox1.items. Add (CS [I]);
}
Private void button#click (Object sender, eventargs E)
{
String [] result = new COM. ayandy. www. Service (). getweatherbycityname (this. combobox2.text, Com. ayandy. www. thedayflagenum. Today );
MessageBox. Show (result [1] + "/" + result [2] + "/" + result [3]);
}
Private void combobox#selectedindexchanged (Object sender, eventargs E)
{
String [] city;
Int16 length;
City = new COM. ayandy. www. Service (). getsupportcity (this. combobox1.text );
Length = convert. toint16 (City [0]);
For (INT I = 1; I <= length; I ++)
This. combobox2.items. Add (City [I]);
}
}
}