| | |
A RSS feed reader....
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
Hiya people been working on a new project.You guessed right a RSS reader for podcasts....I have been able to reach and read text from a sample code I found.But because I am quite a noob I couldn't figured it out how to work it for podcasts...
Here is the code: (Note that I'm currently using .net 2005 and the code you are seeing is the form code...thanks in advance)
program.cs part of the code
Here is the code: (Note that I'm currently using .net 2005 and the code you are seeing is the form code...thanks in advance)
C# Syntax (Toggle Plain Text)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Xml; namespace RSS_Reader { public partial class frmMain : Form { XmlTextReader rssReader; XmlDocument rssDoc; XmlNode nodeRss; XmlNode nodeChannel; XmlNode nodeItem; ListViewItem rowNews; public frmMain() { InitializeComponent(); } private void btnRead_Click(object sender, EventArgs e) { lstNews.Items.Clear(); this.Cursor = Cursors.WaitCursor; rssReader = new XmlTextReader(txtUrl.Text); rssDoc = new XmlDocument(); rssDoc.Load(rssReader); for (int i = 0; i < rssDoc.ChildNodes.Count; i++) { if (rssDoc.ChildNodes[i].Name == "rss") { nodeRss = rssDoc.ChildNodes[i]; } } for (int i = 0; i < nodeRss.ChildNodes.Count; i++) { if (nodeRss.ChildNodes[i].Name == "channel") { nodeChannel = nodeRss.ChildNodes[i]; } } lblTitle.Text = "Title: " + nodeChannel["title"].InnerText; lblLanguage.Text = "Language: " + nodeChannel["language"].InnerText; lblLink.Text = "Link: " + nodeChannel["link"].InnerText; lblDescription.Text = "Description: " + nodeChannel["description"].InnerText; for (int i = 0; i < nodeChannel.ChildNodes.Count; i++) { if (nodeChannel.ChildNodes[i].Name == "item") { nodeItem = nodeChannel.ChildNodes[i]; rowNews = new ListViewItem(); rowNews.Text = nodeItem["title"].InnerText; rowNews.SubItems.Add(nodeItem["link"].InnerText); lstNews.Items.Add(rowNews); } } this.Cursor = Cursors.Default; } private void lstNews_SelectedIndexChanged(object sender, EventArgs e) { if (lstNews.SelectedItems.Count == 1) { for (int i = 0; i < nodeChannel.ChildNodes.Count; i++) { if (nodeChannel.ChildNodes[i].Name == "item") { nodeItem = nodeChannel.ChildNodes[i]; if (nodeItem["title"].InnerText == lstNews.SelectedItems[0].Text) { txtContent.Text = nodeItem["description"].InnerText; break; } } } } } private void lstNews_DoubleClick(object sender, EventArgs e) { System.Diagnostics.Process.Start(lstNews.SelectedItems[0].SubItems[1].Text); } } }
C# Syntax (Toggle Plain Text)
using System; using System.Collections.Generic; using System.Windows.Forms; namespace RSS_Reader { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new frmMain()); } }
"By the data to date, there is only one animal in the Galaxy dangerous to man—man himself. So he must supply his own indispensable competition. He has no enemy to help him."
From Time Enough for Love by Robert A. Heinlein
From Time Enough for Love by Robert A. Heinlein
![]() |
Similar Threads
- create html file from rss feed (PHP)
- RSS feed doesn't validate but why? (RSS, Web Services and SOAP)
- How do I put a blog RSS feed in PHPBB? (PHP)
- How to use this site's RSS feed? (DaniWeb Community Feedback)
- RSS Feed Readers (Geeks' Lounge)
- RSS Feed (Web Browsers)
Other Threads in the C# Forum
- Previous Thread: Animated gif in picturebox
- Next Thread: GroupBox selection and Winform Clearing
| Thread Tools | Search this Thread |
.net access algorithm angle array asp.net barchart bitmap box broadcast c# capturing check checkbox client combobox control conversion csharp custom database datagrid datagridview dataset datetime dbconnection degrees delegate design development disappear draganddrop drawing encryption enum eventhandlers excel file firefox form format forms function gdi+ image index input install java label leak libraries list listbox loop mandelbrot math monodevelop mouseclick msword mysql operator path pause photoshop picturebox pixelinversion post programming radians regex remoting resourcefile richtextbox round server sleep socket sql statistics stream string table tcpclientchannel text textbox thread time timer update usercontrol validation virtualization visualbasic visualstudio webbrowser windows winforms wpf xml






