I have a multi select list box on a form which is a child of an MDI form. I fill the list box with the following code
While objDataReader.Read()
objFuel = New FuelItem(objDataReader("lFuel_ID"
, objDataReader("sFuel_Name"
)
arrFuel.Add(objFuel)
lstFuel.Items.Add(arrFuel)
blnOK = False
End While
lstFuel.DataSource = arrFuel
lstFuel.DisplayMember = "getFuelName"
lstFuel.ValueMember = "getFuelID"
SourcesFuels is a class which I have created. The list box fills fine and then I try to set multiple selected items in the code like this.
While objDataReader.Read()
lstFuel.SetSelected(lstFuel.FindString(objDataReader("sFuel_Name"
), True)
intCount = intCount + 1
End While
The items are selected as they should be.
The Problem occurs when i call the form from the mdi form by pressing a menu button.
If IsNothing(gfrmSources) Then
gfrmSources = New frmFuelSources
ElseIf gfrmSources.IsDisposed Then
gfrmSources = New frmFuelSources
End If
gfrmSources.MdiParent = Me
gfrmSources.Show()
The child form is called, goes through it's functions perfectly, then finishes off the code in the mdi form, which is the end of a select statement ie -
End Select
When the child form displays there is only ever one item selected. The list box seems to drop it's second selected item when the mdi parent finishes off it's code. I think this might be a bug in VB.NET, does anyone have any ideas?
While objDataReader.Read()
objFuel = New FuelItem(objDataReader("lFuel_ID"
arrFuel.Add(objFuel)
lstFuel.Items.Add(arrFuel)
blnOK = False
End While
lstFuel.DataSource = arrFuel
lstFuel.DisplayMember = "getFuelName"
lstFuel.ValueMember = "getFuelID"
SourcesFuels is a class which I have created. The list box fills fine and then I try to set multiple selected items in the code like this.
While objDataReader.Read()
lstFuel.SetSelected(lstFuel.FindString(objDataReader("sFuel_Name"
intCount = intCount + 1
End While
The items are selected as they should be.
The Problem occurs when i call the form from the mdi form by pressing a menu button.
If IsNothing(gfrmSources) Then
gfrmSources = New frmFuelSources
ElseIf gfrmSources.IsDisposed Then
gfrmSources = New frmFuelSources
End If
gfrmSources.MdiParent = Me
gfrmSources.Show()
The child form is called, goes through it's functions perfectly, then finishes off the code in the mdi form, which is the end of a select statement ie -
End Select
When the child form displays there is only ever one item selected. The list box seems to drop it's second selected item when the mdi parent finishes off it's code. I think this might be a bug in VB.NET, does anyone have any ideas?