Hi,
I want to make First Letter capital after Apostrophe Below is the code
For e.g I want name should be written in this way Roshan D'Souza
But below code is giving me output as Roshan d'Souza
Please Help me.
private void txtName_TextChanged(object sender, EventArgs e)
{
int i = txtName.SelectionStart;
if (txtName.Text.Length == 1)
{
txtName.Text = txtName.Text.ToUpper();
}
int index = txtName.Text.IndexOf("'");
if (index != -1)
{
string charAfterApostrophe = txtName.Text.Split('\'')[1];
if (charAfterApostrophe.Length == 1)
{
txtName.Text = txtName.Text.Substring(0, txtName.Text.Length - 1) + charAfterApostrophe.ToUpper();
}
}
txtName.SelectionStart = i;
}