How to convert a string into an Integer in ASP.net?

Answer Posted / suresh

int.Parse parses the input (casts in a sense) to an integer
value however it will throw an exception if it cant do it if
the data provided is not numeric. you should use TryParse in
.NET 2.0 to see if it can parse it.

int a = Int.Parse("int");



Convert.ToInt32() converts the string data to a proper true
int32 value, and throws an exception if it can't convert the
value.


int a = Convert.Int32("String");

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is csrf attack in asp.net?

513


Explain client side state management system.

558


What is asp.net and how it works?

509


Define the steps to set up validation control.

570


How to unit test Web API?

698






How to set the pane area to transparent of a scrollPane component.?

556


What is the difference between debug and release?

512


14. What are your Future Plans for Swatz Oils GROUP U.K?

1713


What is the function of new view engine in asp.net? : asp.net mvc

531


How do you do Client-side validation in .Net?

569


What is the displayafter property in updateprogress control?

502


Diff between web user control and web custom control?

495


What is the sequence in which ASP.NET events are processed?

464


What is cookieless session id explain in brief?

522


what is command line compiler.what are the steps and how it is related to debugging.

1406