ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Microsoft Related >> ASP.NET
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions (615)
 C Sharp interview questions  C Sharp Interview Questions (722)
 ASP.NET interview questions  ASP.NET Interview Questions (1443)
 VB.NET interview questions  VB.NET Interview Questions (150)
 COM+ interview questions  COM+ Interview Questions (41)
 ADO.NET interview questions  ADO.NET Interview Questions (199)
 IIS interview questions  IIS Interview Questions (86)
 MTS interview questions  MTS Interview Questions (5)
 Crystal Reports interview questions  Crystal Reports Interview Questions (62)
 BizTalk interview questions  BizTalk Interview Questions (33)
 Dot Net interview questions  Dot Net Interview Questions (861)
 Exchange Server interview questions  Exchange Server Interview Questions (103)
 SharePoint interview questions  SharePoint Interview Questions (25)
 WCF interview questions  WCF Interview Questions (8)
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions (193)
Question
How to convert a string into an Integer in ASP.net?
 Question Submitted By :: ASP.NET
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
by two ways u can do that
1.

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

2.

int a = Convert.Int32("String");
 
Is This Answer Correct ?    97 Yes 17 No
Guest
 
Answer
# 2
we can do this way also
int intA=Convert.ToInt32("string");
 
Is This Answer Correct ?    45 Yes 21 No
Deva
 
 
 
Answer
# 3
int A = CInt("String") i think this is the best way 
Is This Answer Correct ?    24 Yes 7 No
Bhaskar
 
Answer
# 4
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
Sai Krishna
 
Answer
# 5
int a = Convert.ToInt32("2");

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

Response.Write( a.ToString() + " " + b.ToString());
 
Is This Answer Correct ?    11 Yes 1 No
Sai Krishna
 
Answer
# 6
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
Sanjay
 
Answer
# 7
works only if the input is integer 
Is This Answer Correct ?    15 Yes 11 No
Kiran
 
Answer
# 8
Good 
Is This Answer Correct ?    10 Yes 9 No
Sid
 
Answer
# 9
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
Suresh
 
Answer
# 10
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
Binu
 

 
 
 
Other ASP.NET Interview Questions
 
  Question Asked @ Answers
 
can I use session variable in App_code Class page?? Wipro 3
When during the page processing cycle is ViewState available?   1
Should validation (did the user enter a real date) occur server-side or client-side? Why?   2
What is boxing and how it is done internally? Microsoft 1
How do you use css in asp.net? iBridge 8
Suggest 3 best practices in detail for for Developing High Performance Web and Enterprise Applications Techno-Solutions 2
What r new things introduced in ASP.NET 2.0 in comparision to ASP.NET 1.1   1
what is PostBack Property exactly ? when It Returns True? when it Returns False?   1
what is asp and asp.net ? Inspira-Technologies 2
how to convert from sql2000 numeric to int in asp.net with sqlparameter?   1
What is the use of directives & explain with example? C-Squared-Systems 2
What are typed datasets? IBS 1
 
For more ASP.NET Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com