I am using .Net (C#, WinForms, Linq to SQL, SQL Server 2008) to develop a new line-of-business application that will replace a crufty old Foxpro application. I did not write the old app, but do provide support for it, and I am the in-house developer for the new app.
One of the design decisions that was made years ago with the Foxpro app was to force all entered text to be uppercase. This was to ensure that all text has a uniform format for sales reports, mailing lists, etc.
A current topic of conversation between me and some of the users, is whether this should be continued in the new app. It looks likely that it will be continued.
My question is, what is the best strategy to make this happen, involving the least amount of my time as possible?
It feels like a real drag to always have to remember to set the CharacterCasing property of every. single. textbox. that I drop onto a form. And it appears that DataGridViews don’t even have a simple property to set; you have manually handle CellChanged events, etc.
How would you do it?
Thanks to all who contributed. I thought digEmAll in particular had the best answer. However, I am posting my full implementation as the answer, in order to benefit others who find this questions.
UpperCaseTextBox implementation:
UpperCaseDataGridView implementation:
One could implement this functionality using less code than the above, however, I purposely aimed for a flexible, robust implementation that plays nice with the Properties window, allows me to override the uppercasing in instances where needed without having to tear out the control and replace with vanilla control, etc.
Thanks again to all who contributed.