Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / guest

by two ways u can do that
1.

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

2.

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

Is This Answer Correct ?    100 Yes 18 No

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

Answer / deva

we can do this way also
int intA=Convert.ToInt32("string");

Is This Answer Correct ?    45 Yes 22 No

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

Answer / bhaskar

int A = CInt("String") i think this is the best way

Is This Answer Correct ?    24 Yes 7 No

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

Answer / sai krishna

If you don't pass integer value, it gives the
exception "Input string was not in a correct format."

Is This Answer Correct ?    14 Yes 1 No

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

Answer / sai krishna

int a = Convert.ToInt32("2");

int b = Int32.Parse("3");

Response.Write( a.ToString() + " " + b.ToString());

Is This Answer Correct ?    11 Yes 1 No

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

Answer / sanjay

1))int a=int.Parse("string");
2))int a=Convert.ToInt32("string");
3))int a=(int)"string";

but the string provided should be integer

Is This Answer Correct ?    9 Yes 2 No

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

Answer / kiran

works only if the input is integer

Is This Answer Correct ?    15 Yes 11 No

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

Answer / sid

Good

Is This Answer Correct ?    10 Yes 9 No

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

Answer / 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

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

Answer / binu

All the above are correct. but if you want the integer value of a string( like 'binu') you have to find its ascii value..
There is no other option

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

Difference between .NET components and COM components?

2 Answers   Microsoft,


What is the Difference between Web.config and global.asax? Can we write connection String code in global.asax?

10 Answers   Microsystems,


What is strong name and which tool is used for this?

4 Answers   Accenture,


What is the need of client side and server side validation ?

1 Answers   Keane India Ltd,


How does session authentication work?

0 Answers  


Hey I am using asp.net mvc architecture. I creating one dropdownlist using <select id="State" name="State"></select> this is dynamic list.Its displaying properly. But in time of Edit.If i load a page dropdownlist is not displaying the item which is stored in table.

1 Answers  


What is a 307 redirect?

0 Answers  


Explain Page life cycle

8 Answers   DELL,


What is asp net objects?

0 Answers  


What is manifest in .net framework?

0 Answers  


what is the dllhell? why we use the dllhell?

4 Answers  


Where do the cookie state and session state information be stored?

0 Answers  


Categories