GivenRandy
asked on
ListBox - SelectionMode - MultiSimple - De-selecting All Will Select First
I have a ListBox that has the SelectionMode set to MultiSimple. If I select a couple things from the middle of the list and then de-select them all, after the last one is de-selected, it automatically selects the first one. It doesn't happen this way when I build it from scratch, so there must be some setting or code somewhere. I did a search and breakpoints all over the place, but cannot seem to find the culprit. Any ideas?
ASKER
Nope.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
We never use bound controls, so it was a surprise that this legacy code had it. Great insight!
Okay, I'm a VB.NET neophyte, so what is the spoon-fed code to convert? I have something like:
Dim dt As DataTable
dt = MyFunctionThatReturnsDataT able
If dt.Rows.Count > 0 Then
lstMyList.DataSource = dt
I'll award additional points for that. Ccan I still add separate entries like "Points for ...."? If not, I'll start a new question.
Okay, I'm a VB.NET neophyte, so what is the spoon-fed code to convert? I have something like:
Dim dt As DataTable
dt = MyFunctionThatReturnsDataT
If dt.Rows.Count > 0 Then
lstMyList.DataSource = dt
I'll award additional points for that. Ccan I still add separate entries like "Points for ...."? If not, I'll start a new question.
ASKER
Ah, missed bottom part. This works:
Dim dr As DataRow
For Each dr In dt.Rows
lstMyList.Items.Add(dr("My Column"))
Next
Dim dr As DataRow
For Each dr In dt.Rows
lstMyList.Items.Add(dr("My
Next
No need for a new question anyway, as your own answer looks fine. But
>>
Ccan I still add separate entries like "Points for ...."?
<<
No, I don't think so.
Roger
>>
Ccan I still add separate entries like "Points for ...."?
<<
No, I don't think so.
Roger
-Baan