I wanted to display the remaining characters using a label beside my textbox just in case the user input exceeded the maximum length of characters.
This is my code for remaining characters:
private void txtID_TextChanged(object sender, EventArgs e)
{
int MaxChars = 10 - txtID.Text.Length;
labelChars.Text = MaxChars.ToString() + " characters remaining.";
}
What I wanted to do now is to prevent the user from entering characters in my textbox when he/she already exceeded the character limit. I'm planning to use the Substring property of the textbox but I don't know how. Help me out? Thanks.