Check Input Type of TextBox
T o know what is your input type of your textbox , Simply
write given below code , on button click
private void button1_Click(object sender, EventArgs e)
{
int num = 0;
double d = 0;
bool b = false;
if (int.TryParse(textBox1.Text, out num))
{
MessageBox.Show("input
is=" + num.GetType());
}
else if (double.TryParse(textBox1.Text, out d))
{
MessageBox.Show("input
is=" + d.GetType());
}
else if (Boolean.TryParse(textBox1.Text, out b))
{
MessageBox.Show("input
is=" + b.GetType());
}
else
{
MessageBox.Show("input
is=" + textBox1.Text.GetType());
}
}
You will get the type of input of your textbox.
No comments:
Post a Comment