I have a DGV with a CB column in VS2008. I would like an event when a DGVCB selection is made (without leaving the cell). It will probably have to be a DGV cell or row event but I can't find one that fires as soon as a DGVCB selection is made. thx
Printable View
I have a DGV with a CB column in VS2008. I would like an event when a DGVCB selection is made (without leaving the cell). It will probably have to be a DGV cell or row event but I can't find one that fires as soon as a DGVCB selection is made. thx
One way of achieving the same is as below:
Working fine in VB.Net 2005 and framework 2.0.Code:Public Class Form1
Dim WithEvents MyCbo As ComboBox
Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
If TypeOf e.Control Is ComboBox Then
MyCbo = DirectCast(e.Control, ComboBox)
End If
End Sub
Private Sub MyCbo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyCbo.SelectedIndexChanged
MsgBox(MyCbo.Items(MyCbo.SelectedIndex))
End Sub
End Class
It should work in VS2008 also.
Good luck
Peerrrrfect. thx