To apply TryParse code in Any Windows Form

Pradeep Raturi
Posted by Pradeep Raturi under Windows Forms category on | Points: 40 | Views : 1305
namespace tryparse
{
public partial class Form1: Form
{
public Form1()
{
initialize component();
}
private void button_Click(object sender , EventArgs e)
{
int i,j;
bool a1 =int.TryParse(textBox.Text , out i);
bool a2=int.TryParse(textBox.Text , out i);
if(a1== true && a2==true)
{
int b = i+j;
MessageBox.Show(b.ToString());
}
else
MessageBox.Show("Enter numeric values only");
}
}

Comments or Responses

Login to post response