Hi all,
I think I do something wrong, but I don't see what.
I have made a sample.
The sample needs only a form with a combobox and this code.
(I can tell you that it took a long time to see this, but it still can be
that I do something stupid).
When I fill a combobox (1) direct, I get after SelectionChange Committed the
previous selected item.
When I fill a combobox (2) using a datatable I get after
SelectionChange Committed the selected item (The behaviour that I suspected).
This is the text on MSDN about it,
Occurs when the selected item has changed and that change is committed.
Remarks
You can create a SelectionChange Committed event handler to provide special
handling for the ComboBox when the user changes the selected item in the
list.
(That did me doubt if I understood it well).
I am curious if I become crazy?
(I could find nothing about it on MSDN).
Cor
\\\\
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim i As Integer
For i = 10 To 100 Step 10
Me.ComboBox1.It ems.Add(i.ToStr ing)
Next
Me.ComboBox1.Se lectedIndex = 5
Dim dt As New DataTable
Dim dc As New DataColumn
Dim dr As DataRow
dc.DataType = System.Type.Get Type("System.St ring")
dc.ColumnName = "i"
dt.Columns.Add( dc)
For i = 1 To 10
dr = dt.NewRow()
dr("i") = (i * 10).ToString
dt.Rows.Add(dr)
Next i
Me.ComboBox2.Di splayMember = "i"
Me.ComboBox2.Da taSource = dt
Me.ComboBox2.Se lectedIndex = 5
End Sub
Private Sub ComboBox1_Selec tionChangeCommi tted _
(ByVal sender As Object, ByVal e As System.EventArg s) Handles _
ComboBox1.Selec tionChangeCommi tted
MessageBox.Show (Me.ComboBox1.T ext)
End Sub
Private Sub ComboBox2_Selec tionChangeCommi tted _
(ByVal sender As Object, ByVal e As System.EventArg s) Handles _
ComboBox2.Selec tionChangeCommi tted
MessageBox.Show (Me.ComboBox2.T ext)
End Sub
///