R
Randy
I have a bound listbox on a form. The listobx is bound to a single
column table that contains a list of employees. The listbox's
selection mode is set to MultiSimple. When the form loads, the top
item is selected by default.
What is weird is that whenever I change the selections (e.g. add
another one, deselect the first one, whatever), any code that I have
associated with this listbox will not run. I created a simple example
to try to figure out what is going on, but I am clueless:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
MsgBox("code is running properly")
Dim drvListItem As DataRowView
For Each drvListItem In lbxEmps.SelectedItems
MessageBox.Show(drvListItem(lbxEmps.DisplayMember))
Next
End Sub
If I load the form and click this button immediately, it runs fine,
displaying two messageboxes (the first with my text and the second
with item 0). However, if I make any selection changes to the box and
then click the button, nothing happens. Nothing, that is, except that
all code is suspended and I have to break the execution in the
debugger.
I'm mystified. Can anybody help?
Thanks,
Randy
column table that contains a list of employees. The listbox's
selection mode is set to MultiSimple. When the form loads, the top
item is selected by default.
What is weird is that whenever I change the selections (e.g. add
another one, deselect the first one, whatever), any code that I have
associated with this listbox will not run. I created a simple example
to try to figure out what is going on, but I am clueless:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
MsgBox("code is running properly")
Dim drvListItem As DataRowView
For Each drvListItem In lbxEmps.SelectedItems
MessageBox.Show(drvListItem(lbxEmps.DisplayMember))
Next
End Sub
If I load the form and click this button immediately, it runs fine,
displaying two messageboxes (the first with my text and the second
with item 0). However, if I make any selection changes to the box and
then click the button, nothing happens. Nothing, that is, except that
all code is suspended and I have to break the execution in the
debugger.
I'm mystified. Can anybody help?
Thanks,
Randy