if text1.text = 1.22
this would give me the 1
what would i do to get the 22
answer_dollar.caption = Int(text1.text)
Printable View
if text1.text = 1.22
this would give me the 1
what would i do to get the 22
answer_dollar.caption = Int(text1.text)
Answer_Cents.Caption = Mod(Text1.Text)
Urg, I just suffered an ID-10-T error. Try this instead:
Money = 1.22
MsgBox Money
MsgBox Int(Money)
MsgBox (Money - Int(Money)) * 100
If you're always dealing with 2 decimal places. increase or decrease the 100 depending on the number of decimals.
You could always try mid(Text1.Text,InStr(1,Text1.Text,".") as well ...
If you're not dealing with 2 decimal places, use this code:
(It also works with 2 decimal places)Code:MsgBox Right(CStr(Text1.Text - Int(Text1.Text)), InStr(1, Text1.Text, "."))