I have two listbox controls on the same form that I have populated using an arraylist created from an xml file. When I execute the form, the information appears in the list boxes as it should; however, when I make a selection in one of the list boxes, the selected value in the other changes.
Also, When I go to print out the selected values using:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label3.Text = "Creating Test For " & ListBox1.SelectedValue _
& ":" & ListBox2.SelectedValue & ". Please Wait..."
Label3.Visible = True
End Sub
I get the selected value of the Listbox2 in both inserted places.
When I created these on the form I did not copy paste one from the other, I dragged two new listboxes onto the windows form.
Other things to note. I did populate the two listboxes using the same arraylist object after clearing it using:
xmlDoc.Load("../xml/BatchConfig.xml")
xmlNdList = xmlDoc.GetElementsByTagName("Unit")
For i = 0 To xmlNdList.Count - 1
arlAL.Add(xmlNdList.Item(i).Attributes("Id").Value)
Next
ListBox1.DataSource = arlAL
arlAL.Clear()
xmlNdList = xmlDoc.GetElementsByTagName("Phase")
For i = 0 To xmlNdList.Count - 1
arlAL.Add(xmlNdList.Item(i).Attributes("Id").Value)
Next
ListBox2.DataSource = arlAL
What gives?
Also, When I go to print out the selected values using:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label3.Text = "Creating Test For " & ListBox1.SelectedValue _
& ":" & ListBox2.SelectedValue & ". Please Wait..."
Label3.Visible = True
End Sub
I get the selected value of the Listbox2 in both inserted places.
When I created these on the form I did not copy paste one from the other, I dragged two new listboxes onto the windows form.
Other things to note. I did populate the two listboxes using the same arraylist object after clearing it using:
xmlDoc.Load("../xml/BatchConfig.xml")
xmlNdList = xmlDoc.GetElementsByTagName("Unit")
For i = 0 To xmlNdList.Count - 1
arlAL.Add(xmlNdList.Item(i).Attributes("Id").Value)
Next
ListBox1.DataSource = arlAL
arlAL.Clear()
xmlNdList = xmlDoc.GetElementsByTagName("Phase")
For i = 0 To xmlNdList.Count - 1
arlAL.Add(xmlNdList.Item(i).Attributes("Id").Value)
Next
ListBox2.DataSource = arlAL
What gives?