Help with XML

Nicko101

Member
Joined
Aug 31, 2004
Messages
10
Programming Experience
Beginner
Hi
I am quite a novice programmer and i need a few pointers with XML.

1. Is it possible to populate a List bOx from a Dataset (Created from an XML file)

2. Is it possible to populate an ArrayList (Correct terminology?) from an XML Data table

3. Is it possible to write data to an XML File from a Textbox and back again?

Any help would be greatly appreciated.

Thanks
Nicko101
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
1- To populate a listBox from a dataSet, set the DataSource property of the listBox equal to the DataSet.DataTable that was created from the XML file, then set the DataMember property of the listBox to the field in the dataTable that you want to be displayed.

3- Yes it is possible to write the data contained in a textbox to a XML file and back again. Have a look at the System.XML namespace and the classes therein. There are many possible solutions, so have a start and if you have specific questions, feel free to ask again.
 

Nicko101

Member
Joined
Aug 31, 2004
Messages
10
Programming Experience
Beginner
Paszt said:
1- To populate a listBox from a dataSet, set the DataSource property of the listBox equal to the DataSet.DataTable that was created from the XML file, then set the DataMember property of the listBox to the field in the dataTable that you want to be displayed.

I tryed populating my listbox like this but i only got the name of the column. can i get the data i the column in the listbox?
 

Nicko101

Member
Joined
Aug 31, 2004
Messages
10
Programming Experience
Beginner
I've managed to get the Data from the column into the listbox. Here is the next problem. when a certain item in the listbox is selected, how do i get the data from the same row and the next column in the data table to appear in a Label or textbox?
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
VB.NET:
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, _
  ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
    Label1.Text = ListBox1.Text & " - " & _
      ds.Tables(0).Rows(ListBox1.SelectedIndex).Item("URL")
End Sub
Here my dataSet is named ds and the next column in my case is named "URL".
 
Top Bottom