Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Box 1

Status
Not open for further replies.

AmritPaulSingh

Programmer
Dec 5, 2002
46
0
0
CA

I have a multiple selection list box. How do I get the value of the selection of the list box in a text box?

My lst box (lstPP) contains the following values:
1
2
3
4
5

If I select 1, the text box should get the value 1
If I select 1 and 3, the textbox should get the value 1,3

Help.
Thanks
 
Enter the following code in the after update event of the listbox

Code:
Dim strResult As String
Dim varItm As Variant

For Each varItm In lstPP.ItemsSelected
     strResult = strResult & lstPP.ItemData(varItm)
Next varItm
TextBox = strResult
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top