Hi,
I am creating a basic calcualtor within my Access application.
I'm having trouble assigning the value "0." to num1
When the caluclator loads, num1 = 0, and num2 = 0. When clicking on the "decimal" button, I would like the value of "lblResult" label to display "0." and num1 should equal "0."
My code:
Dim num1 as double
Dim num2 as double
num1 = 0
num2 = 0
If num1 = 0 And prevOperator = "" Then
lblResult.Text = CStr(0 & ".")
num1 = lblResult.Text
End If
My problem seems to be assigning a string to a double. How do I get around this? I need the program to remember that num1 now contains a decimal, so that when the user clicks on the number 1 next, the result will display "0.1"
I'd appreciate any help with this.
BJ
I am creating a basic calcualtor within my Access application.
I'm having trouble assigning the value "0." to num1
When the caluclator loads, num1 = 0, and num2 = 0. When clicking on the "decimal" button, I would like the value of "lblResult" label to display "0." and num1 should equal "0."
My code:
Dim num1 as double
Dim num2 as double
num1 = 0
num2 = 0
If num1 = 0 And prevOperator = "" Then
lblResult.Text = CStr(0 & ".")
num1 = lblResult.Text
End If
My problem seems to be assigning a string to a double. How do I get around this? I need the program to remember that num1 now contains a decimal, so that when the user clicks on the number 1 next, the result will display "0.1"
I'd appreciate any help with this.
BJ