Visual Basic中的禁止错误 [英] Forbidden Error In Visual Basic

查看:100
本文介绍了Visual Basic中的禁止错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个程序可以从国家气象服务rss feed中获取天气警报.效果很好.最近,它给了我程序禁止的错误,但是当我输入URL时,我将警报从Web浏览器中显示出来. 提要.为什么会给我这个,我该如何解决?

这是代码:

使用WB作为新的WebClient
            尝试
                Dim WXData As String = WB.DownloadString("My.Settings.NWS_Alert")
                如果WXData<> LastWXData然后
                    LastWXData = WXData
                    ListBox1.Items.Clear()
                    ListBox1.Enabled =假
                    WXDict.Clear()
                    XmlDoc.LoadXml(WXData)
                    昏暗的TitleList为XmlNodeList = XmlDoc.GetElementsByTagName("description")
                    昏暗的SummaryList为XmlNodeList = XmlDoc.GetElementsByTagName("message")
                    对于i = 1到TitleList.Count-1
                        WXDict.Add(TitleList(i).InnerText,SummaryList(i-1).InnerText)
                    下一个
                    Label6.Text = SummaryList(0).InnerText
                    ListBox1.Items.AddRange(WXDict.Keys.ToArray)
                    ListBox1.Enabled =真
                    ListBox1.SelectedIndex = 0
                万一
            异常捕获
            结束尝试
        最终使用



    结束子
    Dim LastWXData As String =""

在第一部分中,链接被键入到文本框中,并保存在My.Settings.NWS_Alert中.然后,另一个文本框(处于隐藏状态)显示链接,该程序从RSS Feed中获取信息.注意:此提要可在alert.weather.gov上找到 在州旁边的原子图标下,或单击各个县的县.

谢谢!

解决方案

AWL,

请关闭您的其他帖子:

Using WB As New WebClient Try Dim WXData As String = WB.DownloadString("My.Settings.NWS_Alert") If WXData <> LastWXData Then LastWXData = WXData ListBox1.Items.Clear() ListBox1.Enabled = False WXDict.Clear() XmlDoc.LoadXml(WXData) Dim TitleList As XmlNodeList = XmlDoc.GetElementsByTagName("description") Dim SummaryList As XmlNodeList = XmlDoc.GetElementsByTagName("message") For i = 1 To TitleList.Count - 1 WXDict.Add(TitleList(i).InnerText, SummaryList(i - 1).InnerText) Next Label6.Text = SummaryList(0).InnerText ListBox1.Items.AddRange(WXDict.Keys.ToArray) ListBox1.Enabled = True ListBox1.SelectedIndex = 0 End If Catch ex As Exception End Try End Using End Sub Dim LastWXData As String = ""

In the first section, the link is typed into a textbox and is saved in My.Settings.NWS_Alert. Then another textbox (that is hidden) displays the link and the program grabs the information from the RSS Feed. Note: This feeds can be found at alerts.weather.gov under the atom icons next to the states or click counties for individual counties.

Thanks!

解决方案

AWL,

Please close your other post:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/df38ede3-3e45-466f-bc31-c49cd4b682d0/weather-underground-api-in-json-format?forum=vbgeneral#df38ede3-3e45-466f-bc31-c49cd4b682d0


这篇关于Visual Basic中的禁止错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆