How do i get a value of my listview to be displayed in a textbox?
I want to fill my textbox without accessing the database.
Printable View
How do i get a value of my listview to be displayed in a textbox?
I want to fill my textbox without accessing the database.
Is this what you are looking to do:Quote:
Originally Posted by Bonkerz
VB Code:
Me.Text1.Text = Me.Listview1.SelectedItem.Text
Sorry should have elaborated on my problem. I want to get values from from the row i selected to 2 textboxes and i need values from 2 columns in the listview.
VB Code:
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem) Text1.Text = ListView1.SelectedItem.Text Text2.Text = Item.SubItems(1) End Sub
Try this:Quote:
Originally Posted by Bonkerz
VB Code:
Private Sub Command1_Click() Dim a As Long With ListView1 Me.Text1.Item(0).Text = SelectedItem.Text For a = 1 To .ColumnHeaders.Count - 1 Me.Text1.Item(a).Text = .SelectedItem.ListSubItems.Item(a).Text Next a End With End Sub
Don't really understand why the for next is used in your code Mark, anyway it gave me the value of the 2nd subitem and was good otherwise. Didn't think it was that simple Hack, thanks. Thanks for your help too Mark.
The For Next Loop is used to loop through each subitem in the Listview.Quote:
Originally Posted by Bonkerz