-
Listview Items
Can anyone help me i am new to .Net and i can't get this working?
i have a listview which has been populated from a dataset and i want to load the data into text boxes i can get row 0 to load but i want to have it so if i click on row 3 for example it puts row 3's data in to the text boxes.
Please tell me if i'm going wrong or if i'm just stupid!!
if i change the Rows(0) bit the different rows that works but i want it to change when i select the row.
Here is my code
txtUsername.Text = dsUser.Tables("User").Rows(0). Item("Username")
txtUsername.Enabled = False
txtFirstName.Text = dsUser.Tables("User").Rows(0). Item("FirstName")
txtUserInitial.Text = dsUser.Tables("User").Rows(0). Item("MiddleInitial")
txtSurname.Text = dsUser.Tables("User").").Rows(0).Item("Surname")
txtAssetNo.Text = dsUser.Tables("User").").Rows(0).Item("AssetNumber")
txtEmail.Text = dsUser.Tables("User").").Rows(0).Item("EmailAddress")
cboUserLocation.Text = dsUser.Tables("User").").Rows(0).Item("Branch")
cboUserFloor.Text = dsUser.Tables("User").").Rows(0).Item("Floor")
-
-
put this in the click or selectedindexchange event of the listview
Your text box.text = listview.selecteditem(0).subitems(which ever colum).text
Bit confused by your code?? Looks like you are loading from a dataset?
-
sorry yes i am thanks will try
-
sorry it doesn't work say's " 'SelectedItem' is not a member of 'system.windows.forms.listview' "
any other idea's??