PDA

Click to See Complete Forum and Search --> : Changing a string to an integer


Gimpster
Jan 27th, 2000, 07:52 AM
In the MSDN files, it says that you can convert a string to an integer if the string is in an integer format. Here is what it says you can do:

strprice = "100.00"
intprice = strprice

This code works, but I need something different. What I need to do is something more like this:

For i = 0 to 5
strprice = MSHFlexgrid.TextMatrix(i, 4)
intprice = strprice
Next i

However, when I do that, it gives me an error because the datatypes are different. What can I do to fix this problem?


------------------
Ryan

Phobic
Jan 27th, 2000, 08:48 AM
Why don't you just convert it into an integer the good ol' fashioned way (Cint(String Expression)) and then use the format function to convert it to whatever (in this case, Format(Cint(String Expression), "####0.00").

DiGiTaIErRoR
Jan 27th, 2000, 10:34 AM
ACTUALLY the 'good 'ol fashion way' would be simply this:
Val(String)
Simple ain't it!
And a integer to a string?
Str(Integer)
Just as simple!

------------------
DiGiTaIErRoR
VB, QBasic, Iptscrae, HTML
Quote: There are no stupid questions, just stupid people.

Gimpster
Jan 28th, 2000, 12:02 AM
Thanks, it works great now!

------------------
Ryan