Fill textbox from Listview

teodormircea

Active Member
Joined
Jan 8, 2008
Messages
331
Hello forum<


What is the most easy way to fill textbox from an listview,
I have a listview with 5 columns , and i want to fill 5 textbox when i click on a line from listview
thanks for advice;)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi,

I added a listview control and five textboxes to my userform. I left them with their default names, so Textbox1, Textbox2,.... Textbox5.

[I populated the listview in the userform's initialise event handler.]

I then added this event handler code to the userform's class module which should give you the general idea:
Code:
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
    
    Dim c As Integer
    
    With Item
        TextBox1.Text = .Text
        
        For c = 2 To 5
            Controls("TextBox" & c).Text = .SubItems(c - 1)
        Next c
    End With
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,958
Messages
6,122,475
Members
449,087
Latest member
RExcelSearch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top