大家好,我需要一些有关我的问题的帮助。
我正在进行天气预报(C#语言中的REST方法)
我写的代码,它没有显示任何福彩12选5走势图或警告。
但是当我运行调试器时会显示福彩12选5走势图(请参见图片)
PS:我使用Visual Basic 2010专业版。
http://imageshack.us/photo/my-images/844/error1z.jpg/
这是我写的代码。
有人可以纠正我犯的福彩12选5走势图吗?因为我尝试修复了将近一个小时,但看不到我的福彩12选5走势图
我试图改变的价值"Fnumber"但是福彩12选5走势图仍然存在。
PS:我希望这是发布此主题的正确地方。
我正在进行天气预报(C#语言中的REST方法)
我写的代码,它没有显示任何福彩12选5走势图或警告。
但是当我运行调试器时会显示福彩12选5走势图(请参见图片)
PS:我使用Visual Basic 2010专业版。
http://imageshack.us/photo/my-images/844/error1z.jpg/
这是我写的代码。
using System.Xml.Linq; using System.Net; namespace RESTService { public partial class Form1 : Form { public Form1() { InitializeComponent(); // Obtain the Foracast. GetForecast(); // Display the Forecast data. DisplayData(ForecastNumber); } // Holds all of the weather data XDocument GetData; // Contains just the forecast. IEnumerable<XElement> Forecast; //Specifies which Forecast to use. Int32 ForecastNumber; // Defines the maximum number of farecast. Int32 MaxForecasts; // Contains a list of icons associated with the forecast. IEnumerable<XElement> Icons; // Specifies which icon to use. Int32 IconNumber; public void GetForecast() { // Contains the result of a retry request. DialogResult TryAgain = DialogResult.Yes; // Keep trying to get the weather data until the user // Gives up or the call is successful. while (TryAgain == DialogResult.Yes) { try { // Get the weather data. GetData = XDocument.Load( "http://api.wunderground.com/auto/wui/geo" + "/ForecastXML/index.xml?query=" + txtLocation.Text); // End the loop TryAgain = DialogResult.No; } catch (WebException) { TryAgain = MessageBox.Show( "Couldn't obtain the weather data! \r\n Try again?", "Data Download Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error); } } // Obtain all the forecasts. Forecast = GetData.Element("forecast").Element("txt_forecast").Elements("forecastday"); // Define the maximum number of forecasts. MaxForecasts = Forecast.Count() - 1; // Specify which forecast to use. ForecastNumber = 1; // Specify which icon to use. IconNumber = 1; // Reset the buttons. btnNext.Enabled = true; btnPrevious.Enabled = false; } public void DisplayData(Int32 FNumber) { // Display the title of the current forecast. txtTitle.Text = Forecast.ElementAt(FNumber).Element("title").Value; // Display detailed forecast information. txtForecast.Text = Forecast.ElementAt(FNumber).Element("fctext").Value; // Obtain a list of icons associated with the forecast. Icons = Forecast.ElementAt(FNumber).Element("icons").Elements("icon_set"); // Define the maximum numbers of available icons. IconSelect.Maximum = Icons.Count() - 1; // Display the icon on screen. wbIcon.Url = new Uri(Icons.ElementAt(IconNumber).Element("Icon_url").Value); }
有人可以纠正我犯的福彩12选5走势图吗?因为我尝试修复了将近一个小时,但看不到我的福彩12选5走势图
我试图改变的价值"Fnumber"但是福彩12选5走势图仍然存在。
PS:我希望这是发布此主题的正确地方。
由主持人最后编辑: