'Allow user to enter new values for ALL DataGridViewComboBox controls in the DataGridView If (TypeOf e.Control Is DataGridViewComboBoxEditingControl) Then Dim cmb As DataGridViewComboBoxEditingControl = CType(e.Control, DataGridViewComboBoxEditingControl) If Not cmb Is Nothing Then cmb.DropDownStyle = ComboBoxStyle.DropDown End If End If ' stop user from entering anything but a decimal number with 2 decimal places into column 3 If (TypeOf e.Control Is DataGridViewTextBoxEditingControl) Then If (JobComponentsDataGridView.CurrentCell.ColumnIndex = 2) Then Dim textBox As TextBox textBox = CType(e.Control, TextBox) If (Not (textBox) Is Nothing) Then AddHandler textBox.KeyPress, AddressOf DataGridViewTextColumn_KeyPress_NumericOnly RemoveHandler Me.JobComponentsDataGridView.EditingControlShowing, AddressOf JobComponentsDataGridView_EditingControlShowing End If End If End If
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)