My form contains several DataGridView controls that have two columns. I want the data that the user types into column 1 to be converted to upper case. The data in column 0 is read only and is populated by my program. It is numeric and does not need to be converted to upper case. The code below works but I'm wondering if there's a better way.
private: System::Void dataGridView_patterns_EditingControlShowing(System::Object^ sender, System::Windows::Forms::DataGridViewEditingControlShowingEventArgs^ e)
{
// This event sets the character casing to upper for the patterns. It is called once per pattern.
TextBox^ myControl;
myControl = (TextBox^)(e->Control);
myControl->CharacterCasing = CharacterCasing::Upper;
}
The only problem that I have with this code is that the EditingControlShowing event is called once for every row in the DataGridView. Is there a way to set the CharacterCasing to Upper one time for the control, or does it have to be set for every row to work properly? I don't notice any performance issues, but it just seems unnecessary to set the casing for every row in the control.
Thank you!