listbox databinding gets bungled
I have a very simple two-tier listbox: changing value in Top loads a new array to Bottom. The Top is bound to arrTop , a collection of clsTop, which in turn is a collection of clsBot's.
Now, all works fine until i put ANY code at all into the Bottom listbox SelectedValueChanged routine. Then the text in the bottom listbox stops showing. The values are there, i can click on them, but their color is white on white.
Here's the code (the SelectedValueChanged is at the bottom):
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
arrTop = New ArrayList
Dim newLine As New clsTop
newLine.Name = "Top1"
newLine.Add(New clsBot("1-1"))
Dim newLine2 As New clsTop
newLine2.Name = "top2"
newLine2.Add(New clsBot("2-1"))
newLine2.Add(New clsBot("2-2"))
newLine2.Add(New clsBot("2-3"))
newLine2.Add(New clsBot("2-4"))
newLine2.Add(New clsBot("2-5"))
newLine2.Add(New clsBot("2-6"))
newLine2.Add(New clsBot("2-7"))
newLine2.Add(New clsBot("2-8"))
newLine2.Add(New clsBot("2-9"))
newLine2.Add(New clsBot("2-10"))
arrTop.Add(newLine)
arrTop.Add(newLine2)
lstTop.DataSource = Nothing
lstTop.DataSource = arrTop
lstTop.DisplayMember = "Name"
End Sub
Private Sub lstTop_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstTop.SelectedIndexChanged
lstBot.DataSource = Nothing
lstBot.DataSource = lstTop.SelectedValue
lstBot.DisplayMember = "Name"
End Sub
Private Sub lstBot_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstBot.SelectedValueChanged
Dim curBot As clsBot = lstBot.SelectedValue
chkProcessed.Checked = curBot.Processed
If Not curBot.Processed Then curBot.Process()
lstBot.Refresh()
'lstBot.ForeColor = Color.AliceBlue
End Sub