How do I convert a string into an Integer? [Print this FAQ]
Answer:
Due to changes in VB.NET and C#, when programming ASP.NET Web pages, developers must be aware of a variable's data type. Oftentimes, trying to assign a String variable to a variable of type Integer will result in a "Type Mismatch" error.
To successfully convert a String into an Integer, you can use one of two techniques: via the Parse method of the Int32 class
' VB.NET code Dim sNumber as String = "123" Dim iNumber as Integer = Convert.ToInt32(sNumber)
And there you have it! To learn more about ASP.NET be sure to check out the ASP.NET Article Index!
Happy Programming!
FAQ posted by Scott Mitchell at
7/10/2001 3:54:31 PM to the
ASP.NET category.
This FAQ has been viewed 123,762 times.
Do you have a FAQ you'd like to suggest?
Suggestions? Comments? If so, send it in!
Also, if you'd like to be a FAQ Admin (creating/editing FAQs),
let me know! If you are looking for other FAQs, be
sure to check out the 4Guys
FAQ and Commonly Asked Messageboard Questions!