The following method needs to successful take a user input and update their input to title case format e.g capital at the beginning of every word as they are typing, this is entered into a text box on a win form project. I have an issue with this method as it converts properly until I press caps lock or shift. It will also work if i hold both the buttons down not to sure if this just cancels each other out. I have been looking into Regex but not to sure how to implement it in this class. please find the code below for the function thanks in advance.
// User input stored in Temp Var
string myText = tbProductId.Text;
//
if (myText.Equals(null))
{
// validation, check if the user has entered anything, if Null.
MessageBox.Show("Please enter somthing");
}
else
{
// convert to Title Case
tbProductId.Text = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(tbProductId.Text);
tbProductId.Focus();
tbProductId.Select(tbProductId.Text.Length, 0);
//Move Cursor to location of where error was found
}