private void DataGrid_KeyDown(object sender, KeyEventArgs e)
{
// subroutine has its own error handling
try
{
GridViewCell cell;
// get the current cell, if any
cell = DataGrid.CurrentCell;
if (cell != null)
{
// if the current cell is in the CODE column...
if (cell.Column.Header.ToString().ToUpper() == "CODE")
{
// set any textboxes to force upper case
IList<TextBox> txtList = cell.ChildrenOfType<TextBox>();
foreach (TextBox txt in txtList)
{
txt.CharacterCasing = CharacterCasing.Upper;
}
}
}
}
catch (Exception ex)
{
w.MessageInternal("DataGrid_KeyDown: " + ex.ToString());
}
}