Re: Two variables problem
Maybe if you post your actual code it would help explain what the problem is?
Re: Two variables problem
If Text1.Text is "clear", it has probably nothing entered to it. In this case you would set Num to nothing, what should happen with Num, what happens if Num is nothing?
Re: Two variables problem
opus, I didn't understand what you meant
I have a calculator and I want "=" button to calculate and to convert units each other. "=" calculates now but it doesn't convert unit each other. I don't want to make a new button for conversion
These are codes:
Private Sub cmd_equal_Click()
sayi2 = Text1.Text
If isaret = "+" Then
Text1.Text = sayi1 + sayi2
ElseIf isaret = "-" Then
Text1.Text = sayi1 - sayi2
ElseIf isaret = "*" Then
Text1.Text = sayi1 * sayi2
ElseIf isaret = "/" Then
Text1.Text = sayi1 / sayi2
ElseIf isaret = "^" Then
Text1.Text = sayi1 ^ sayi2
End If
Private Sub Command1_Click()
Dim A As Double, B As Double
A = Text2.Text
If Combo2.Text = "Degree" And Combo3.Text = "Radian" Then
B = 3.1415926535898 * A / 180
Text3.Text = B
ElseIf Combo2.Text = "Degree" And Combo3.Text = "Degree" Then
B = A
Text3.Text = B
ElseIf Combo2.Text = "Degree" And Combo3.Text = "Grad" Then
B = 10 * A / 9
Text3.Text = B
ElseIf Combo2.Text = "Radian" And Combo3.Text = "Degree" Then
B = 180 * A / 3.1415926535898
Text3.Text = B
ElseIf Combo2.Text = "Radian" And Combo3.Text = "Radian" Then
B = A
Text3.Text = B
ElseIf Combo2.Text = "Radian" And Combo3.Text = "Grad" Then
B = 200 * A / 3.1415926535898
Text3.Text = B
ElseIf Combo2.Text = "Grad" And Combo3.Text = "Grad" Then
B = 9 * A / 10
Text3.Text = B
ElseIf Combo2.Text = "Grad" And Combo3.Text = "Radian" Then
B = 3.1415926535898 * A / 200
Text3.Text = B
ElseIf Combo2.Text = "Grad" And Combo3.Text = "Grad" Then
B = A
Text3.Text = B
End If
End Sub
Re: Two variables problem
From your first post, I think your structure just wasn't correct....
Code:
If num2 = Val(Text1.Text) Then
' do your standard calculation
Else
' do your conversion
End If