Convert decimal value to whole number...

I am using an MSFLexgrid with 2 columns (each column formats the value to a different decimal place), and a textbox to edit the values.  The user types in a value (6 digit max) in each column which for column1 is automatically formatted to 3 decimal places (i.e. 123.456) and for column 2 the user selects desired decimal setting from a combo box.  What I need is to take the value entered in col 2 for each cell and send it as a whole number in a command instead of a decimal value (i.e if the user's value for col 2 is 1234.56 I need to send 123456).  I have tried the Cint function with no luck.  
Anjinsan5Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vb_jonasCommented:
Cint takes the integer of the number. A trick is to do it this way

newvalue = cint(value+0.5)
0
Ashish PatelCommented:
if there are 2 decimals then multiply it with 100 and if there are 3 then multiple by 1000
0
vb_jonasCommented:
Also - isn't there a round-function in VB6?

newvalue = round(value)
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

vb_jonasCommented:
ah sorry... *must check my glasses, or answer questions when I'm not tired*


you could also do this:

stringvalue = replace(cstr(value),".","")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Anjinsan5Author Commented:
Thanks for the replies so far...the problem i'm having is the user will select a decimal format of their choice from a combo box (options are ddddd.d, dddd.dd, ddd.ddd, dd.dddd, and d.ddddd) and whatever value they type into col 2 of the msflexgrid will automatically format according to their selection.  I did try the options you gave, however when I take the user's value and convert to whole number and send the value to a device it still reads as a decimal value.  Hope I didn't totally confuse anyone...
0
Anjinsan5Author Commented:
Sorry vb jonas...I posted that last comment before you gave your latest solution.  Your idea worked great! Thanks so much for the help!
0
Anjinsan5Author Commented:
Great help!
0
Ashish PatelCommented:
or just do one simple thing as below

1. convert the value to string first by using CSTR(variable)
2. replace "." (period) with "" (blank) by using Replace(CSTR(variable), ".", "")
3. convert the value to long again by finally saying Clng("0" & Replace(CSTR(variable), ".", ""))

so  finally use this Clng("0" & Replace(CSTR(variable), ".", "")) for any level of decimal point number.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.