Home
Manage Your Code
Snippet: ArrayList ListBox (C#)
Title: ArrayList ListBox Language: C#
Description: ListBox population from XML Views: 240
Author: Ramachandran Melarcode Date Added: 6/27/2008
Copy Code  
1private void button2_Click(object sender, EventArgs e)
2
3{
4
5IsDataSet = false;
6
7DataSet ds = new DataSet();
8
9ds.ReadXml("http://www.eggheadcafe.com/rss.xml");
10
11DataTable dt = ds.Tables[2];
12
13ArrayList al = new ArrayList();
14
15string thename;
16
17string thevalue;
18
19foreach (DataRow row in dt.Rows)
20
21{
22
23thename = (string)row["title"];
24
25thevalue = (string)row["link"];
26
27al.Add (new CustomItem(thename,thevalue)); 
28
29}
30
31listBox1.DataSource =al; 
32
33}
34
Usage
ListBox population from XML
Notes
ListBox population from XML