Click to See Complete Forum and Search --> : How to convert String to Integer in VB6?


jimcheng
April 26th, 2001, 04:46 PM
As the title, how could I convert the String into Integer in VB6?

Say:

Dim str As String
Dim num As Integer

str = "12345"

How could I set the integer value to num (12345) here ?

Thanks!
Jim Cheng

T Mac
April 26th, 2001, 05:37 PM
Dim str As String
Dim num As Integer

str = "12345"
num = val(str)

cksiow
April 27th, 2001, 04:31 AM
dim str as string
dim num as Integer

num = CInt(str)




you might want to use IsNumeric function to check if the string is a valid numeric value first before convert it.

HTH

cksiow
http://vblib.virtualave.net - share our codes