English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am making an application in which one button click must run through a list if options like this
>If T1.Text = "Y" And T2.Text = "Z" Then T3.Text = "X"
>If T1.Text = "Y" And T3.Text = "Z" Then T2.Text = "X"
>If T1.Text = "Y" And T4.Text = "Z" Then T7.Text = "X"
and if more than one applies only choose the first one that applies on the list and not carry out more than one command

2006-12-14 04:01:59 · 6 answers · asked by lamebrain 2 in Computers & Internet Programming & Design

6 answers

Dim X
X=0
Do While X=0
If T1.Text="Y" and T2.Text="Z" Then
T3.Text="X"
X=1
End If
If T1.Text="Y" and T3.Text="Z" and X <> 1 Then
X=1
T2.Text="X"
End If
If T1.Text="Y" and T4.Text="Z" and X <> 1Then
X=1
T7.Text="X"
End If
Loop

Nice and easy.

2006-12-14 06:26:50 · answer #1 · answered by DimensionalStryder 4 · 0 1

Or, something like this would work... if you have multiple things to do other than just set T3, T2, or T7.


Public Sub Button_Click()
If T1.Text = "Y" And T2.Text = "Z" Then
HandleFirstCase()
ElseIf T1.Text = "Y" And T3.Text = "Z" Then
HandleSecondCase()
ElseIf T1.Text = "Y" And T4.Text = "Z" Then
HandleThirdCase()
End If

End Sub

Private Sub HandleFirstCase()
T3.Text = "X"
End Sub

Private Sub HandleSecondCase()
T2.Text = "X"
End Sub

Private Sub HandleThirdCase()
T7.Text = "X"
End Sub

2006-12-14 04:38:40 · answer #2 · answered by Brett C 1 · 0 0

try using elseif

>If T1.Text = "Y" And T2.Text = "Z" then T3.Text = "X"
elseIf T1.Text = "Y" And T3.Text = "Z" thenT2.Text = "X"
elseif If T1.Text = "Y" And T4.Text = "Z" Then T7.Text = "X"

2006-12-14 04:08:23 · answer #3 · answered by sm177y 5 · 0 0

If ((T1.Text = "Y") And (T2.Text = "Z")) Then
T3.Text = "X"
ElseIf ((T1.Text = "Y") And (T3.Text = "Z")) Then
T2.Text = "X"
ElseIf ((T1.Text = "Y") And (T4.Text = "Z")) Then
T7.Text = "X"
EndIf

2006-12-14 04:07:30 · answer #4 · answered by paj21 2 · 0 0

hard q wish 2 be the best answer bye bye

2006-12-14 04:04:28 · answer #5 · answered by amr h 1 · 0 2

http://www.good-tutorials.com/
http://www.digitaljuice.com/
http://www.tutorialkit.com/
http://www.codestyles.com/
http://www.sitecube.com/website/promo_bw.asp?pid=sitetarget

2006-12-14 05:02:09 · answer #6 · answered by GEORGE N 4 · 0 0

fedest.com, questions and answers