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;)
 

Some videos you may like

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Colin Legg

MrExcel MVP, Like totally RAD man
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,841
Messages
5,598,388
Members
414,234
Latest member
grlevesq

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
Top