Test for Decimal

BrandonMPSMI

Active member
Joined
Oct 8, 2008
Messages
43
Programming Experience
Beginner
In my attempts to build a calculator I have stumbled upon a problem.

How can I test if the Memory has a decimal?
 
In my calc program I have a boolean to keep track of when a decimal's been entered. However when you store the number in memory you'll need to find out if it already has a decimal in it in which when I display the number back in the textbox I use the IndexOf method on the string, if it's greater than negative one then there's a decimal

Now with all that said, I haven't worked on my calc program in a very long time (it was originally started back in 2003 using VS 2003) in which since then I've learned about using the NumericUpDown control back in 2004 and I would advise you to start using that control for your calc's numeric input, the control handles the decimal stuff and everything.
 
Back
Top