Option Strict Off Option Explicit On Friend Class Form1 Inherits System.Windows.Forms.Form '// hangman template by gp Aug 01, modified Jul 05, jul 06, upgraded to .NET 09 '// ** copy the following questions first into word etc and answer them** '********************WORK in PAIRS ********************** '0 Write a brief algorithm for Hangman '1 What happens in form load? '2 What does the 'initialise' procedure do? '3 What (code) happens when you click the play button? '4 What does the 'getword ' sub-routine do? '5 What data type is words? '6 What data structure is words? '7 What is the purpose of length in the for loop in the 'cmdguess procedure? '8 What does the mid function do in cmdguess? '9 What is the difference between a function and a procedure? ' 10 What is the boolean variable, gotOneRight used for? ' 11 Make hangman! ' 12 Try making a keypad for user input rather than text box Dim words(55) As String Dim word As String Dim length As Short Dim gotOneRight As Boolean Dim count2 As Short 'counters Dim i As Integer Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load initialise() loadWordFile() End Sub Public Sub loadWordFile() ' open file for reading, load words into words array Dim templine As String i = 0 FileOpen(1, My.Application.Info.DirectoryPath & "\wordlist.txt", OpenMode.Input) Do Until EOF(1) templine = LineInput(1) ' read line by line i = i + 1 words(i) = templine ' put words into array Loop FileClose(1) End Sub Private Sub cmdplay_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdplay.Click getword() End Sub Public Sub getword() 'randomly gets a word from array and displays it's (blank)characters Const NUMofWORDS As Integer = 55 Randomize() word = words(Rnd() * NUMofWORDS + 1) ' get one word from the words array MsgBox(word) ' test word ' **** TO DO below - 'display the word as blank text boxes 'For i = 1 To what here?? 'Txt1(i).Visible = True 'Next End Sub ' below is INCOMPLETE guess procedure Private Sub cmdGuess_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdGuess.Click 'txtguess is the letter guess box 'txt1(i) is the control array that displays correct letters For i = 1 To length If Txtguess.Text = Mid(word, i, 1) Then ' if a match, show letter Txt1(i).Text = Txtguess.Text gotOneRight = True End If Next If gotOneRight = False Then ' bad guess ' show image End If End Sub Public Sub initialise() ' set all letter displays to blank For i = 1 To 10 Txt1(i).Text = "" Txt1(i).Visible = False Next ' also set all pictures to not visible Lblwrong.Text = "" Txtguess.Text = "" End Sub Public Sub wastetime() ' waste a second Dim start As Date start = TimeOfDay Do Loop Until Second(System.Date.FromOADate(TimeOfDay.ToOADate - start.ToOADate)) > 1 End Sub Public Sub quit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles quit.Click End End Sub End Class