TextBox takes input only letters
Hi, I have a problem while taking input in textbox that it takes input all characters. I want it to take only letters(caps and small both) as input.
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Charith Liyanagamage112 reputationPosted Jun 20, 2009, 10:03 AM EDT
//Function
public static bool IsDigit(string tcString)
{
//get the first character in the string
char c = tcString[0];
return Char.IsDigit(c);
}
//button_click event
private void button1_Click(object sender, EventArgs e)
{
char[] letters=new char[50];
int len = textBox1.Text.Length;
for (int j = 0; j < len; j++)
{
letters[j] = Convert.ToChar(textBox1.Text.Substring(j, 1));
}
for (int i = 0; i < len; i++)
{
bool result = IsDigit(letters[i].ToString());
if (result == true)
{
MessageBox.Show(letters[i]+"is a digit");
}
}
}
if you need any clarification regarding above code please write to me......
Neetu Goswami3 reputationPosted Jun 20, 2009, 11:30 PM EDT
Charith Liyanagamage112 reputationPosted Jun 24, 2009, 9:06 AM EDT