Groups | Blog | Home
all groups > asp.net > february 2007 >

asp.net : Parseint in vb.net?


Garg
2/13/2007 10:49:07 PM
Please tell me how do we use parseint function or its equivalent in
vb.net.
And also tell me how do we hide and display controls during run-time
in vb.net? I need to access the rows of a table for rendering them
during run-time.
Henrik Stidsen
2/14/2007 1:05:28 AM
[quoted text, click to view]

There are two functions:
Integer.parse(stringWithNumber) which returns an integer but throws an
exception if the string is not a number.

The other one, which I recommend, is Integer.tryParse, use it like
this:
Dim outNumber as Integer
If not Integer.tryParse(stringWithNumber, outNumber) Then
outNumber = defaultValue
End If
----

If stringWithNumber is not parseable as an Integer outNumber is set to
0.
Garg
2/14/2007 2:33:00 AM
Thanks a lot Henrik!!
I was kinda stuck there...since am new to vb.net
AddThis Social Bookmark Button