Labels

Thursday, November 11, 2010

Int. TryParse

This one is for me. Sometime it become hard to remember J

 

int checkZero1 = 0;

int checkZero2 = 0;

long checkZero3 = 0;

 

string number1 = "1234567891"; // Allows Max 10 characters

string number2 = "1234567891"; // Allows Max 10 characters // Same as int

string number3 = "1234567891234567891"; // Allows Max 19 characters

 

int.TryParse(number1, out checkZero1);

Int32.TryParse(number2, out checkZero2);

Int64.TryParse(number3, out checkZero3);

 

MessageBox.Show(checkZero1.ToString());

MessageBox.Show(checkZero2.ToString());

MessageBox.Show(checkZero3.ToString());

 

 

Thanks & Regards,

Arun Manglick

 

 

 

 

 

 

 

 

 

 

No comments:

Post a Comment