D
Dominique Vandensteen
dotnet framework v1.0.3705 in vs 2002
code below
whats happening
when I select something else than first element in my combobox and then I do
a combobox1.selectindex = -1 the first element is selected
so instead of being -1 it is 0 (checked with debugger)
if the first element is checked and I do combobox1.selectindex = -1, then
nothing is selected (normal)
the thing is that I have to call ComboBox1.SelectedIndex = -1 twice
but also the indexchanged event is raised twice (unkewl)
somebody saw this problem?
code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim table As DataTable
table = New DataTable()
table.Columns.Add("id")
table.Columns.Add("name")
table.Rows.Add(New Object() {1, "one"})
table.Rows.Add(New Object() {2, "two"})
table.Rows.Add(New Object() {3, "much more"})
ComboBox1.DataSource = table
ComboBox1.DisplayMember = "name"
ComboBox1.ValueMember = "id"
ComboBox1.SelectedIndex = -1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ComboBox1.SelectedIndex = -1
End Sub
code below
whats happening
when I select something else than first element in my combobox and then I do
a combobox1.selectindex = -1 the first element is selected
so instead of being -1 it is 0 (checked with debugger)
if the first element is checked and I do combobox1.selectindex = -1, then
nothing is selected (normal)
the thing is that I have to call ComboBox1.SelectedIndex = -1 twice
but also the indexchanged event is raised twice (unkewl)
somebody saw this problem?
code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim table As DataTable
table = New DataTable()
table.Columns.Add("id")
table.Columns.Add("name")
table.Rows.Add(New Object() {1, "one"})
table.Rows.Add(New Object() {2, "two"})
table.Rows.Add(New Object() {3, "much more"})
ComboBox1.DataSource = table
ComboBox1.DisplayMember = "name"
ComboBox1.ValueMember = "id"
ComboBox1.SelectedIndex = -1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ComboBox1.SelectedIndex = -1
End Sub