g_johnson
asked on
C# datagridview row enforcing casing
Based on somebody's answer to a previous question, I enforce character casing in datagridview cells as seen in the attached code.
Now I need to selectively enforce casing. That is, for colDesc1 I don't want to enforce casing whereas for colItemNo I do want to enforce casing.
I can't find a way to do this. I tried e.Control.Name, but it is an empty string. I noticed e.Control.Tag, but cannot assign a tag in the datagridview interface. I tried e.Control.Location, but that didn't work.
Any suggestions?
Now I need to selectively enforce casing. That is, for colDesc1 I don't want to enforce casing whereas for colItemNo I do want to enforce casing.
I can't find a way to do this. I tried e.Control.Name, but it is an empty string. I noticed e.Control.Tag, but cannot assign a tag in the datagridview interface. I tried e.Control.Location, but that didn't work.
Any suggestions?
private void dgvMain_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (e.Control is TextBox)
((TextBox)e.Control).CharacterCasing = CharacterCasing.Upper;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for the help