|
-
Feb 27th, 2007, 06:28 AM
#1
Thread Starter
Frenzied Member
Listing Titles from XML file
this codes adds all records in one line, how can i seperate these to have one line each?????
Code:
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
ListBox1.Items.Clear()
Dim nlx As New System.IO.StreamReader("C:\Documents and Settings\Owner\Desktop\newslist.xml")
'XML reader
Dim nx As New System.Xml.XmlTextReader(nlx)
'XML doc
Dim nlxd As New System.Xml.XmlDocument
nlxd.Load(nx)
Dim dd As String = nlxd.InnerText
Dim x As Integer
For x = 1 To 10
ListBox1.Items.Add(dd)
Next x
End Sub
-
Feb 27th, 2007, 07:10 AM
#2
Re: Listing Titles from XML file
I don't use XML at all so this is probably wrong but is the problem with the assignment of variable dd?
Are you adding all text to a single string variable? If so, then you could parse the dd string variable into its single units (one per line) and then add those to the listbox.
Alternatively, could you make dd a string array and add the inner text elements to each array element?
-
Feb 27th, 2007, 11:50 AM
#3
Re: Listing Titles from XML file
Use the .SelectNodes() method of the XMLDocument object to retrieve a collection of nodes. You can then loop through that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|