Converting a string to a number

# Thread: Converting a string to a number

1. Junior Member
Join Date
Dec 1969
Posts
15

## Converting a string to a number

I have a series of radio buttons that I need to return the values 1, 2, 3, 4 etc however they are actually returning "1", "2", "3"<BR><BR>How can I convert this value to a numeric in order that I can then perform a comparison agains a number in my database ??

2. Senior Member
Join Date
Dec 1969
Posts
2,849

## RE: Converting a string to a number

The simplest way to coerce a variable to be an integer is through a function called CInt<BR><BR>Dim x, y<BR>x = "5"<BR>y = CInt(x) &#039 y = 5, not "5"<BR><BR>For more info check out: http://msdn.microsoft.com/scripting/vbscript/doc/vsfctCInt.htm<BR><BR>

3. Junior Member
Join Date
Dec 1969
Posts
15

## RE: Converting a string to a number - Thanks

Fanrastic, Thanks Scott, so simple it makes you wonder why I have spent all morning trying to do it <BR><BR>Doh<BR>

4. Junior Member
Join Date
Dec 1969
Posts
15

## RE: Converting a string to a number - Thanks

Fanrastic, Thanks Scott, so simple it makes you wonder why I have spent all morning trying to do it <BR><BR>Doh<BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•