hello all
i have a simple program that allows users to input numbers by key board or buttons clicked my problem is getting a decimal point to display and be put in the variable used for calculation
by clicking the button "." any ideas thanks john
Printable View
hello all
i have a simple program that allows users to input numbers by key board or buttons clicked my problem is getting a decimal point to display and be put in the variable used for calculation
by clicking the button "." any ideas thanks john
To tell you the truth, I have absolutely NO idea what you just said, but I'll hazard a guess here:
VB Code:
If Not TextBox1.Text.IndexOf(".") > 0 Then TextBox1.Text = TextBox1.Text & "." End If
hello mendhak
i have reread my post and it is a bit fuzzy, i have tried your suggestion and it does indeed put a decimal point into the
textbox however the way i have the other buttons coded i lose the decimal place after i input another value, this is a sample
i have n1 declared as public decimal
if n1>=1 then
n1=(n1 * 10) + 2 <--diff value for each button 1,2,3,etc
end if
if n1 = 0 then
n1 = 2 <--- value of button 1,2,3,4 etc
end if
txtnum1.text=n1
this code gives correct input until i use decimal point
how can i recode the numbers(buttons) so the decimal point remains after i put it in the n1 variable thanks john
type the entire number into the textbox first then send it to the variable.
hello wossname
it works fine the way it is if i type the numbers in using the keyboard i need to use the buttons to enter the numbers
i am thinking of using string.endswith(.) to check for a decimal point. then starting a new variable say n2 for all input after the decimal point and then simply adding the two together
numberbeforedecimal + number afterdecimal=finalnumber
if ther was some simpler way to input the numbers though the use of buttons i wish someone would tell me thanks john
is there a way to check a string for integer vs decimal something like the isnumeric checks for numeric data
hello all
i found the solution to my problem by simplifing how i input the numbers
n1=txtnum1.text & "."
n1 =txtnum1.text & "1" for all numbers 1,2,3,4,etc
i had a rather compicated method that involved division by ten to move a decimal place
thanks for all your help john