Hi guys,

Currently I have a list view which is populated from a table in a Access database. It currently shows 3 columns of data which is fine. When I click on the item It populates the left hand side whith is full off text boxes such as 'Name', 'Address Lines' 'Country' Etc, etc..

What I would like is the other data from the dataset to be pasted into these text boxes when the corresponding selection is made in the list view.

Hopefully someone will show me an easy way to do this?

I am guessing I would need to use and IF statement to check to make sure the selected account ID in list view matches the ID in the dataset and then fill the text boxes accordingly??

So Far I have the following:

   if (listView1.SelectedItems.Count > 0)
            {
                txtAccRef.Text = listView1.SelectedItems[0].Text;
                txtName.Text = listView1.SelectedItems[0].SubItems[1].Text;
                txtTown.Text = listView1.SelectedItems[0].SubItems[2].Text;

Which is the information from the Listview but as I said, there is more data to be shown on the text boxes.

For examples I have a Address text box. how would I show the address information from the same datable in the text boxes for the same record?

Sorry, bit of a newbie here. but I am learning!

Hi Mikey,

Thanks for your reply to this one also,

I think I found a sneaky little work around on this. I added the Columns to the Listview and then just set the Width to '0'. This hides the columns from view but still allows me to add the selected items into the text boxes.

Another little job ticked off my list.

Edited 4 Years Ago by sundog1: forgot.

This question has already been answered. Start a new discussion instead.