Seperate decimal from whole number
-
I am trying to edit the decimal part of a number so if a person enters 40.25 i can chane it to 40.375 but i need it to work with any whole number any ideas? I was thinking i could use: dim a as decimal dim b as integer dim c as decimal a = textbox1.text b = textbox1.text if a - b = .25 then c = b + .375 textbox2.text = c I wished we used the metric system in the US would make my like easy 1. Out of clutter, find simplicity. 2. From discord, find harmony. 3. In the middle of difficulty lies opportunity. Albert Einstein three rules of work
-
I am trying to edit the decimal part of a number so if a person enters 40.25 i can chane it to 40.375 but i need it to work with any whole number any ideas? I was thinking i could use: dim a as decimal dim b as integer dim c as decimal a = textbox1.text b = textbox1.text if a - b = .25 then c = b + .375 textbox2.text = c I wished we used the metric system in the US would make my like easy 1. Out of clutter, find simplicity. 2. From discord, find harmony. 3. In the middle of difficulty lies opportunity. Albert Einstein three rules of work
What about using "mod" to get the remainder then working with that? mod = Divides two numbers and returns only the remainder. For Example: 40 mod 1 = 0 40.25 mod 1 = .25 So you could write something like this to get the decimal(remainder) part of any number entered: dim d as single = input mod 1 if d = .25 then 'do something end if