I’m using a datagridview in my windows program. In column 1 user will enter capital letter and number. In some other columns (column 3 and 4) user will enter only integer number(no decimal allowed). I’m writing the following code to convert the entered value into capital letter for column 1: In CellEndEdit event
string strUpper = "";
switch (e.ColumnIndex)
{
case 1:
strUpper = dgView.CurrentCell.Value.ToString() ;
dgView.CurrentCell.Value = strUpper.ToUpper();
break;
}
The entered value is converted to uppercase when focus is moving to next cell. But I want to know is there any other event/code to do the same? And how not to allow user to enter decimal in cell 3 and 4. Please help.
You could use
CellValidatingevent of theDataGridViewlike this: