Hello!
Thanks, Callum Kerr. Check out my website for information on my software products. Xbox Live Gamertag: callum151000
I am looking to have an RSS feed reader within my program, I have code but I am having difficulty getting the content to appear correctly.
Here is my code:
Imports System.Net
Imports System.Text
Imports System.Xml
'Input into textbox:
RSSNEWSREADER.Text = ProcessRSS("http://feeds.rapidfeeds.com/27057/", "Regpro")
'The procedure called from above:
Public Shared Function ProcessRSS(ByVal rssURL As String, ByVal feed As String) As String
Dim request As WebRequest = WebRequest.Create(rssURL)
Dim response As WebResponse = request.GetResponse()
Dim sb As New StringBuilder("")
Dim rssStream As Stream = response.GetResponseStream()
Dim rssDoc As New XmlDocument()
rssDoc.Load(rssStream)
Dim rssItems As XmlNodeList = rssDoc.SelectNodes("rss/channel/item")
Dim title As String = ""
Dim link As String = ""
Dim upperlimit As Integer = rssItems.Count
If upperlimit > 5 Then
upperlimit = 5
End If
If upperlimit > 0 Then
sb.Append("<p>" + feed + "</p><ul>")
Dim i As Integer = 0
While i < upperlimit
Dim rssDetail As XmlNode
rssDetail = rssItems.Item(i).SelectSingleNode("title")
title = rssDetail.InnerText
rssDetail = rssItems.Item(i).SelectSingleNode("link")
link = rssDetail.InnerText
sb.Append("<li><a href='" + link + "' target='_blank'>" + title + "</a></li>")
i += 1
End While
sb.Append("</ul>")
End If
Return sb.ToString()
End Function
When I run the program, I get this in the textbox called "RSSNEWSREADER"
<p>Regpro</p><ul><li><a href='http://feeds.rapidfeeds.com/?iid4ct=4230778' target='_blank'>NEW!</a></li></ul>
I am not sure how to get the RSS to appear like it does in the website, unless I am doing something wrong.
Can anyone help me?
Thanks for your time!
Thanks, Callum Kerr. Check out my website for information on my software products. Xbox Live Gamertag: callum151000