Hi, I'm afraid this doesn't fix the problem. I'd already seen this "bug" and
tried the workarounds. It says it affects version 1.0 of the Framework,
whereas we're on v1.1.
If I create a plain window, it works fine. It's only when my window is a
child window of an MDIParent that it ignores my attemps to set SelectedIndex
= -1.
You should be able to recreate this fairly easily...
Create a form with two MenuItems on it...
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem1.Click
' if I do this it will ignore my SelectedIndex = -1 and set it to 0
Dim x As New Form2
x.MdiParent = Me
x.Show()
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem2.Click
' if I do this, it will set SelectedIndex = -1 with no problems!!
Dim x As New Form2
x.Show()
End Sub
FYI, Form2 is my test form. It has one combobox, and code in the form load
to get a DataTable, bind it to the combobox and try to set the SelectedIndex
= -1 (see my original post)
Thanks,
Steve
"Herfried K. Wagner [MVP]" wrote:
> "Steve Dyte" <Steve (E-Mail Removed)> schrieb:
> > ComboBox1.ValueMember = "chCountryCode"
> > ComboBox1.DisplayMember = "chCountryDesc"
> > ComboBox1.SelectedIndex = -1
> >
> > I've already tried setting SelectedIndex = -1 twice, but that doesn't fix
> > it. The only thing that seems to fix it is making the window non-childmdi,
> > but our application is an MDI style app!
>
> BUG: ComboBox Does Not Clear When You Set SelectedIndex to -1
> <URL:http://support.microsoft.com/?scid=kb;EN-US;327244>
>
> --
> Herfried K. Wagner [MVP]
> <URL:http://dotnet.mvps.org/>
>
>