if bedingung ... end sub

dr_pepper

Mitglied
hey,

Foglendes Problem. sagen wir mein Code sieht so aus:

Code:
Private Sub Command1_Click()
If Text1.Text = "hallo" Then
MsgBox "hallo ist die falsche antwort"
End If

Form1.Caption = "k"
End Sub

Jetzt möchte ich aber das wenn in text1.text "hallo" steht das er die Form1.Caption auchnicht ändert. (also er soll alles andere was in Command1_Click steht NICHTMEHR machen.

ich habe mir schon überlegt sowas wie


Code:
Private Sub Command1_Click()
If Text1.Text = "hallo" Then
MsgBox "hallo ist die falsche antwort"
End Sub
End If

Aber das kann natürlich nicht funktionieren. ;D
Jemand ne idee?

Danke.
mfg dr_pepper
 
Hallo
Code:
Private Sub Command1_Click()
  If Text1.Text = "hallo" Then
    MsgBox "hallo ist die falsche antwort"
  Else
    Form1.Caption = "k"
  End If
End Sub
 
Hallo
Code:
Private Sub Command1_Click()
  If Text1.Text = "hallo" Then
    MsgBox "hallo ist die falsche antwort"
  Else
    Form1.Caption = "k"
  End If
End Sub

Hey,

Hier mal ein auszug aus meinem Code

Code:
If Check1.Value = Unchecked And Check2.Value = Unchecked Then
Picture1.Visible = True
Picture2.Visible = False
Label3.Caption = 0
Label4.Caption = 0
MsgBox ("ERROR! U MUST CHECK A CHECKBOX!")
End If

If Combo1.Text = "zeit" Then
Timer1.Interval = 0
Picture1.Visible = True
Picture2.Visible = False
Label3.Caption = 0
Label4.Caption = 0
MsgBox ("ERROR! CHOOSE A TIME!")
End If

zeitchen = (Text1.Text) * 60
Timer1.Interval = 1000
Picture1.Visible = False
Picture2.Visible = True

Da funktioniert das mit dem Else leider nicht (oder?)
 
Ich weiß nicht genau was du machen willst.

Beispiel:
Code:
If Check1.Value = vbUnchecked And Check2.Value = vbUnchecked Then
  Picture1.Visible = True
  Picture2.Visible = False
  Label3.Caption = 0
  Label4.Caption = 0
  MsgBox ("ERROR! U MUST CHECK A CHECKBOX!")
Else
  If Combo1.Text = "zeit" Then
    Timer1.Interval = 0
    Picture1.Visible = True
    Picture2.Visible = False
    Label3.Caption = 0
    Label4.Caption = 0
    MsgBox ("ERROR! CHOOSE A TIME!")
  Else
    zeitchen = (Text1.Text) * 60
    Timer1.Interval = 1000
    Picture1.Visible = False
    Picture2.Visible = True
  End If
End If
 
Zurück