|
Hi I have a User Control which has a DataGridView in this and there is a Combobox cell. what i want when user enteres any values in that combobox and hit enter a evetn should be fired and we can trap that event. Now my prooblem is that as soon as i type something and hit enter the values of that combo box cell disappears. I am using Following Line of Code [Code] Try Dim Key As Keys If DataGridView1.Rows(e.RowIndex).Cells("EditObject").Value = 1 Then Dim CategoryNameCell2 As DataGridViewComboBoxCell = _ DirectCast(DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewComboBoxCell) 'If Key = Keys.Enter Then ' MessageBox.Show("Enter Key has been pressed") If Not CategoryNameCell2.Items.Contains(e.FormattedValue) Then RemoveHandler editingComboBox.SelectedIndexChanged, AddressOf editingComboBox_SelectedIndexChanged CategoryNameCell2.Items.Clear() CategoryNameCell2.Items.Add(e.FormattedValue) CategoryNameCell2.Value = e.FormattedValue.ToString DataGridView1.Rows(e.RowIndex).Cells("colStart").Value = e.FormattedValue.ToString AddHandler editingComboBox.SelectedIndexChanged, AddressOf editingComboBox_SelectedIndexChanged ' MessageBox.Show(e.FormattedValue) End If 'End If End If Catch ex As Exception End Try [Code] Please suggest me how can i do this
|