fange gerade an mich bisschen mit Coden via VB6 zu beschäftigen hab auf Youtube erstmal zum anfang ein Hangman Tutorial angeguckt und bin grad dabei aber jetzt bekomm ich sobald ich Start drücke was zum debuggen:
Code:
Dim Ratewords(9) As String
Dim Rateword As String
Dim Keyword As String
Dim Letter As String
Dim lifelost As Boolean
Dim life As Integer
Dim gr As Integer
Dim kr As Integer
Dim zuf As Integer
Private Sub Command1_Click()
Letter = Text1.Text
Letter = UCase(Letter)
Text1.Text = ""
If Len(Letter) = 1 Then
If Asc(Letter) > 64 And Asc(Letter) < 91 Then
lifelost = True
For i = 1 To Len(Rateword)
If Mid(Letter, i, 1) = Letter Then
Mid(Keyword, i, i) = Letter
Label1.Caption = Keyword
lifelost = False
If Keyword = Rateword Then
Box = MsgBox("You win Play again?", 36, "Win")
End If
End If
Next
Else
Box = MsgBox("Only tip in Letters, please", 0, "Error")
End If
Else
Box = MsgBoy("Please only tip in 1 Letter no more!", 0, "Error")
End If
Text1.SetFocus
End Sub
Private Sub Form_Load()
Ratewords(1) = "SHOE"
Ratewords(2) = "LEG"
Ratewords(3) = "JAMES"
Ratewords(4) = "NOSE"
Ratewords(5) = "ICETEA"
Ratewords(6) = "COMPUTER"
Ratewords(7) = "HACKER"
Ratewords(8) = "PEARLS"
Ratewords(9) = "MUSIC"
kl = 0
gr = 9
Randomize
zuf = Int(Rnd + (gr - kl + 1)) + kl
[COLOR="Red"] Rateword = Ratewords(zuf)[/COLOR]
For i = 1 To Len(Rateword)
Keyword = Keyword + "-"
Next
Label1.Caption = Keyword
life = 15
Label2.Caption = life
End Sub
Private Sub Form_Unload(Cancel As Integer)
Box = MsgBox("Would you really like to Close it?", 36, "Closerequest")
If Box = 6 Then
Else
Cancel = 1
End If
End Sub
Wäre gut wenn jemand eine Antwort weiß und nett wenn er mir die lösung sagt:P






