Victor Charles
asked on
How to view data from a table with multiple rows
I am using the code below to view countries in a table. How do I modify the code to use a next button to see all the countries in the table? The code below only displays the first record.
For Each xnDonor As Xml.XmlNode In xdDonor.SelectNodes("/Root /CountryTa ble[Countr y_ID='" & DonorID & "']")
DonorID2 = xnDonor.SelectSingleNode(" Country_ID ").InnerTe xt
Name = xnDonor.SelectSingleNode(" Country"). InnerText
dtDonor.Rows.Add({DonorID2 , Name})
Next
C1CountryOrigin.Text = dtDonor.Rows(0).Item("Coun try")
Thanks,
Victor
For Each xnDonor As Xml.XmlNode In xdDonor.SelectNodes("/Root
DonorID2 = xnDonor.SelectSingleNode("
Name = xnDonor.SelectSingleNode("
dtDonor.Rows.Add({DonorID2
Next
C1CountryOrigin.Text = dtDonor.Rows(0).Item("Coun
Thanks,
Victor
ASKER
Hi,
C1CountryOrigin is a textbox, I need to see the data in the next row when I click on a Next button. What code do I use to see data in each fow?
C1CountryOrigin is a textbox, I need to see the data in the next row when I click on a Next button. What code do I use to see data in each fow?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Edited above to assign value to textbox.
Did that answer your question?
Did that answer your question?
ASKER
Hi,
Juast read your post, will test it and get back to you.
Thanks,
Victor
Juast read your post, will test it and get back to you.
Thanks,
Victor
ASKER
It worked! How do you move to first and last record?
Thanks,
Thanks,
ASKER
Thank You!
on the other hand, if you want to display them in a combobox, simply set its datasource to the datatable, e.g ComboBox1.DataSource = dtDonor (you may want to set the DisplayMember and the value Member if you choose this route).
In the same way, if you want to display the rows in a datagrid (or even datagridview), simply set its datasource to the datatable, e.g DataGridView1.DataSource = dtDonor (in this case the columns will be autogenerated from the datatable)