pruebens Posted December 20, 2002 Posted December 20, 2002 How would I get the contents of a listbox to a variable I try dim var as string = me.listbox1.items but that doesn't seem to work. Quote
Moderators Robby Posted December 20, 2002 Moderators Posted December 20, 2002 if you want only the selected item... dim var as string = ListBox1.SelectedItem this will get all selected items... Dim nCounter As integer Dim s As String For nCounter = 0 To ListBox1.Items.Count - 1 If ListBox1.GetSelected(nCounter) = True Then s = s & ListBox1.Items(nCounter) End If Next label1.Text = s this will get all items, even if they are not selected Dim nCounter As Short Dim s As String For nCounter = 0 To ListBox1.Items.Count - 1 s = s & ListBox1.Items(nCounter) Next Label1.Text = s Quote Visit...Bassic Software
pruebens Posted December 20, 2002 Author Posted December 20, 2002 Thanks Robby........you're a champ! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.