HANGMAN
30.11.2005 13:33:26
Boris
Ich soll in Inf Hangman programmieren (Wortraten).
Ich habe schon etwas programmiert, aber irgendwie kann ich die Buchstaben nicht
prüfen. Wenn ihr mir mein Fehler finden würdet, wäre ich sehr froh.
Gruß Boris
Mein Code:
Dim wort, striche, neustriche As String
Dim i As Integer
Private Sub CommandButton1_Click()
wort = TextBox1.Value
striche = ""
For i = 1 To Len(wort)
striche = striche & "-"
Next i
TextBox1.Value = striche
End Sub
Private Sub CommandButton2_Click()
buchstabe = TextBox2.Value
striche = neustriche
For i = 1 To Len(wort)
If Mid(wort, i, 1) = buchstabe Then
neustriche = neustriche & buchstabe
Else: neustriche = neustriche & Mid(striche, i, 1)
End If
Next i
End Sub
Private Sub CommandButton3_Click()
If wort = TextBox3.Value Then
TextBox5.Value = "Richtig"
ElseIf wort <> TextBox3.Value Then
TextBox5.Value = "Falsch"
End If
End Sub