-
Oct 30th, 2011, 04:43 AM
#1
Thread Starter
Member
Two variables problem
I have a situation about assigning two variables bottom of any event
For example,
Private Sub cmd_esit_Click()
num2 = Text1.Text
If
...
...
End If
Dim A As Integer
A = Text2.Text
If
..
..
End If
Click event depends on num2 = Text1.Text
When Text1.Text is clear, click event doesn't work
I want two different event happen independently
-
Oct 30th, 2011, 04:57 AM
#2
Re: Two variables problem
Maybe if you post your actual code it would help explain what the problem is?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Oct 30th, 2011, 05:51 AM
#3
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?
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Oct 30th, 2011, 07:04 AM
#4
Thread Starter
Member
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
Last edited by _MeRKeZ_; Nov 1st, 2011 at 12:36 AM.
-
Oct 30th, 2011, 09:48 AM
#5
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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|