Public Class Form1
Dim mysteryword As String
Dim wordbank(2) As String 'array '(numbers)refers to how many we things we want to store 'start from 0
Dim entry As String
Dim i, n As Integer
Dim r As New Random
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wordbank(0) = "pluto" 'the word we store
wordbank(1) = "mars"
Label1.Text = "?????"
i = r.Next(0, 2)
mysteryword = wordbank(i)
Label1.Text = wordbank(i)
Label1.Text = ""
End Sub
Private Sub Check_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Check.Click
Dim entry, location
entry = TextBox1.Text
location = mysteryword.IndexOf(entry, 0) 'start to check for the answer from 0
If location >= 0 Then
Label1.Text = Label1.Text.Remove(location, 1)
Label1.Text = Label1.Text.Insert(location, entry)
Else
Life.Text -= 1 'life
History.Text &= " " & TextBox1.Text 'when guess wrongly
End If
TextBox1.Text = " "
If Life.Text = 0 Then
MsgBox("You Got It WRONG.") 'pop up msg for wrong answer
End If
If Life.Text = 0 Then Button1.Enabled = True
If Button1.Enabled = True Then Life.Text = 5 'restart life
If Button1.Enabled = True Then History.Text = ""
If Button1.Enabled = True Then Label1.Text = ""
End Sub
Private Sub Solve_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Solve.Click
Dim a As String
a = InputBox("", "") 'trial & error
If a = mysteryword Then
MsgBox("Fantastic!") 'pop up msg for correct answer
Label1.Text = mysteryword
Else : MsgBox("You got it wrong.") 'pop up msg for wrong answer
End If
' dont know how to make the questions marks change.
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
i = r.Next(0, 2)
mysteryword = wordbank(i)
Label1.Text = wordbank(i)
Label1.Text = ""
For n = 1 To mysteryword.Length 'example n=1 to 7 then 7 ???????
Label1.Text &= "?"
Next
End Sub
End Class
Labels: WTF