Make listbox1 = listbox 2 (all items)

12padams

Well-known member
Joined
Feb 19, 2010
Messages
48
Programming Experience
Beginner
Basically on form2 i have a listbox.
And on form3 i have 6 listboxes.

I want listbox 2 to equal listbox (a listbox on form3)

my current code does not work

Private Sub formAustralia_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If lblAustraliaTitle.Text = "Australia" Then
Form3.ListBox1 = Bases
End If
End Sub

By the way "bases" is a lisbox on the current form2
 
You don't want the ListBoxes to be equal. What you want is for the two ListBoxes to contain the same items, e.g.
VB.NET:
For Each item In ListBox1
    ListBox2.Ites.Add(item)
Next
 
Wrong... I can't do that.

Reason is that the items from form3 on the listbox are kinda randomly generated and i don't know what they will hold.... so i can't just say add...

Is there a way to add all the items that are in that textbox into the one i want without saying which is which?
 
Just forget it ill just use show and hide commands instead which is messy but... it will just have to do since visual basic does not have this 1 simple thing...
 
Back
Top