|
-
Jun 30th, 2005, 05:05 AM
#1
Thread Starter
Member
display listview data in textbox [RESOLVED]
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.
Last edited by Bonkerz; Jun 30th, 2005 at 08:48 PM.
-
Jun 30th, 2005, 05:18 AM
#2
Re: display listview data in textbox
 Originally Posted by Bonkerz
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:
VB Code:
Me.Text1.Text = Me.Listview1.SelectedItem.Text
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Jun 30th, 2005, 05:29 AM
#3
Thread Starter
Member
Re: display listview data in textbox
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.
-
Jun 30th, 2005, 05:39 AM
#4
Re: display listview data in textbox
VB Code:
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Text1.Text = ListView1.SelectedItem.Text
Text2.Text = Item.SubItems(1)
End Sub
-
Jun 30th, 2005, 05:45 AM
#5
Re: display listview data in textbox
 Originally Posted by Bonkerz
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.
Try this:
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
Last edited by Mark Gambo; Jun 30th, 2005 at 09:36 AM.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Jun 30th, 2005, 08:47 PM
#6
Thread Starter
Member
Re: display listview data in textbox
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.
-
Jun 30th, 2005, 11:03 PM
#7
Re: display listview data in textbox
 Originally Posted by Bonkerz
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.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|