How to make a DataGrid work the same,when a user clicks or presses keys

Aug 2 2006 12:35 PM

Hi
I have a DataGrid with comboboxes (inherited from
DataGridTextBoxColumn) and I'm woundering what methods or something runs when a user clicks in the DataGrid or ComboBox. In the comboboxes I use the KeyUp event for the user to choose an item in the combobox. When I choose an item with keys nothing happens, but when I click and choose an item in my combobox a new row appear in the DataGrid and that is what I want to happen.

Is there someway I can get the same thing to happen whether I click or press
keys in the combobox.

Here is the code for using the keys to choose an item in the comboboxes

 

Private Shadows Sub IntelliCmb_KeyUp(ByVal sender As Object, _

        ByVal e As System.Windows.Forms.KeyEventArgs) Handles ColumnComboBox.KeyUp

            Dim index As Integer

            Dim actual As String

            Dim found As String

            If ((e.KeyCode = Keys.Back) Or _

               (e.KeyCode = Keys.Left) Or _

               (e.KeyCode = Keys.Right) Or _

               (e.KeyCode = Keys.Up) Or _

               (e.KeyCode = Keys.Down) Or _

               (e.KeyCode = Keys.PageUp) Or _

               (e.KeyCode = Keys.PageDown) Or _

               (e.KeyCode = Keys.Home) Or _

               (e.KeyCode = Keys.ShiftKey) Or _

               (e.KeyCode = Keys.Tab) Or _

               (e.KeyCode = Keys.F2) Or _

               (e.KeyCode = Keys.End)) Then

                Return

            End If

 

            If e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Delete Then

    If ColumnComboBox.Text = "" Then                                         

         mblnEditing = True

               End If

               Return

            End If

 

 

            actual = ColumnComboBox.Text

            index = ColumnComboBox.FindString(actual)

            If (index > -1) Then

                ColumnComboBox.SelectedIndex = index

                ColumnComboBox.SelectionStart = actual.Length

                ColumnComboBox.SelectionLength = found.Length

                If ColumnComboBox.SelectedIndex <> 0 Then

                    mblnEditing = True

                End If

 

 

            End If


Please, I need help!!!!


Fia