ust like a few others, i was assigned a Hangman project for VB.NET!!!

Yea so this is wat we have to do

-----read a word from a text box - DONE

-----when play is clicked, the word is read and the number of letters is replaced with an underscore (_ ) - DONE

check if the letter clicked is in the word -NOT DONE HAS TO BE A FUNCTION! - so that all u have to do is call the function for each letter

display the letter if it is found- NOT DONE also a function

each miss should have a part of the man be built - NOT DONE, should be a function

please somebody help me, i have till sunday to finish this, i've been trying and trying, and i'm still lost....


here is my code so far... please help me, i'm seriosly desperate, its realy messed up, dont know wats wrong nor how to fix it

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents btna As System.Windows.Forms.Button
    Friend WithEvents btnm As System.Windows.Forms.Button
    Friend WithEvents btnl As System.Windows.Forms.Button
    Friend WithEvents btnk As System.Windows.Forms.Button
    Friend WithEvents btnj As System.Windows.Forms.Button
    Friend WithEvents btni As System.Windows.Forms.Button
    Friend WithEvents btng As System.Windows.Forms.Button
    Friend WithEvents btnf As System.Windows.Forms.Button
    Friend WithEvents btne As System.Windows.Forms.Button
    Friend WithEvents btnd As System.Windows.Forms.Button
    Friend WithEvents btnc As System.Windows.Forms.Button
    Friend WithEvents btnb As System.Windows.Forms.Button
    Friend WithEvents btnu As System.Windows.Forms.Button
    Friend WithEvents btnt As System.Windows.Forms.Button
    Friend WithEvents btns As System.Windows.Forms.Button
    Friend WithEvents btnr As System.Windows.Forms.Button
    Friend WithEvents btnq As System.Windows.Forms.Button
    Friend WithEvents btnp As System.Windows.Forms.Button
    Friend WithEvents btno As System.Windows.Forms.Button
    Friend WithEvents btnn As System.Windows.Forms.Button
    Friend WithEvents btny As System.Windows.Forms.Button
    Friend WithEvents btnx As System.Windows.Forms.Button
    Friend WithEvents btnw As System.Windows.Forms.Button
    Friend WithEvents btnv As System.Windows.Forms.Button
    Friend WithEvents btnz As System.Windows.Forms.Button
    Friend WithEvents btnh As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Button2 = New System.Windows.Forms.Button()
        Me.btna = New System.Windows.Forms.Button()
        Me.btnm = New System.Windows.Forms.Button()
        Me.btnl = New System.Windows.Forms.Button()
        Me.btnk = New System.Windows.Forms.Button()
        Me.btnj = New System.Windows.Forms.Button()
        Me.btni = New System.Windows.Forms.Button()
        Me.btnh = New System.Windows.Forms.Button()
        Me.btng = New System.Windows.Forms.Button()
        Me.btnf = New System.Windows.Forms.Button()
        Me.btne = New System.Windows.Forms.Button()
        Me.btnd = New System.Windows.Forms.Button()
        Me.btnc = New System.Windows.Forms.Button()
        Me.btnb = New System.Windows.Forms.Button()
        Me.btny = New System.Windows.Forms.Button()
        Me.btnx = New System.Windows.Forms.Button()
        Me.btnw = New System.Windows.Forms.Button()
        Me.btnv = New System.Windows.Forms.Button()
        Me.btnu = New System.Windows.Forms.Button()
        Me.btnt = New System.Windows.Forms.Button()
        Me.btns = New System.Windows.Forms.Button()
        Me.btnr = New System.Windows.Forms.Button()
        Me.btnq = New System.Windows.Forms.Button()
        Me.btnp = New System.Windows.Forms.Button()
        Me.btno = New System.Windows.Forms.Button()
        Me.btnn = New System.Windows.Forms.Button()
        Me.btnz = New System.Windows.Forms.Button()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(8, 200)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(80, 24)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Start"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(184, 80)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(232, 40)
        Me.Label1.TabIndex = 1
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(8, 224)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(80, 24)
        Me.Button2.TabIndex = 2
        Me.Button2.Text = "Exit"
        '
        'btna
        '
        Me.btna.Location = New System.Drawing.Point(56, 256)
        Me.btna.Name = "btna"
        Me.btna.Size = New System.Drawing.Size(32, 32)
        Me.btna.TabIndex = 3
        Me.btna.Text = "A"
        '
        'btnm
        '
        Me.btnm.Location = New System.Drawing.Point(440, 256)
        Me.btnm.Name = "btnm"
        Me.btnm.Size = New System.Drawing.Size(32, 32)
        Me.btnm.TabIndex = 4
        Me.btnm.Text = "M"
        '
        'btnl
        '
        Me.btnl.Location = New System.Drawing.Point(408, 256)
        Me.btnl.Name = "btnl"
        Me.btnl.Size = New System.Drawing.Size(32, 32)
        Me.btnl.TabIndex = 5
        Me.btnl.Text = "L"
        '
        'btnk
        '
        Me.btnk.Location = New System.Drawing.Point(376, 256)
        Me.btnk.Name = "btnk"
        Me.btnk.Size = New System.Drawing.Size(32, 32)
        Me.btnk.TabIndex = 6
        Me.btnk.Text = "K"
        '
        'btnj
        '
        Me.btnj.Location = New System.Drawing.Point(344, 256)
        Me.btnj.Name = "btnj"
        Me.btnj.Size = New System.Drawing.Size(32, 32)
        Me.btnj.TabIndex = 7
        Me.btnj.Text = "J"
        '
        'btni
        '
        Me.btni.Location = New System.Drawing.Point(312, 256)
        Me.btni.Name = "btni"
        Me.btni.Size = New System.Drawing.Size(32, 32)
        Me.btni.TabIndex = 8
        Me.btni.Text = "I"
        '
        'btnh
        '
        Me.btnh.Location = New System.Drawing.Point(280, 256)
        Me.btnh.Name = "btnh"
        Me.btnh.Size = New System.Drawing.Size(32, 32)
        Me.btnh.TabIndex = 9
        Me.btnh.Text = "H"
        '
        'btng
        '
        Me.btng.Location = New System.Drawing.Point(248, 256)
        Me.btng.Name = "btng"
        Me.btng.Size = New System.Drawing.Size(32, 32)
        Me.btng.TabIndex = 10
        Me.btng.Text = "G"
        '
        'btnf
        '
        Me.btnf.Location = New System.Drawing.Point(216, 256)
        Me.btnf.Name = "btnf"
        Me.btnf.Size = New System.Drawing.Size(32, 32)
        Me.btnf.TabIndex = 11
        Me.btnf.Text = "F"
        '
        'btne
        '
        Me.btne.Location = New System.Drawing.Point(184, 256)
        Me.btne.Name = "btne"
        Me.btne.Size = New System.Drawing.Size(32, 32)
        Me.btne.TabIndex = 12
        Me.btne.Text = "E"
        '
        'btnd
        '
        Me.btnd.Location = New System.Drawing.Point(152, 256)
        Me.btnd.Name = "btnd"
        Me.btnd.Size = New System.Drawing.Size(32, 32)
        Me.btnd.TabIndex = 13
        Me.btnd.Text = "D"
        '
        'btnc
        '
        Me.btnc.Location = New System.Drawing.Point(120, 256)
        Me.btnc.Name = "btnc"
        Me.btnc.Size = New System.Drawing.Size(32, 32)
        Me.btnc.TabIndex = 14
        Me.btnc.Text = "C"
        '
        'btnb
        '
        Me.btnb.Location = New System.Drawing.Point(88, 256)
        Me.btnb.Name = "btnb"
        Me.btnb.Size = New System.Drawing.Size(32, 32)
        Me.btnb.TabIndex = 15
        Me.btnb.Text = "B"
        '
        'btny
        '
        Me.btny.Location = New System.Drawing.Point(408, 288)
        Me.btny.Name = "btny"
        Me.btny.Size = New System.Drawing.Size(32, 32)
        Me.btny.TabIndex = 16
        Me.btny.Text = "Y"
        '
        'btnx
        '
        Me.btnx.Location = New System.Drawing.Point(376, 288)
        Me.btnx.Name = "btnx"
        Me.btnx.Size = New System.Drawing.Size(32, 32)
        Me.btnx.TabIndex = 17
        Me.btnx.Text = "X"
        '
        'btnw
        '
        Me.btnw.Location = New System.Drawing.Point(344, 288)
        Me.btnw.Name = "btnw"
        Me.btnw.Size = New System.Drawing.Size(32, 32)
        Me.btnw.TabIndex = 18
        Me.btnw.Text = "W"
        '
        'btnv
        '
        Me.btnv.Location = New System.Drawing.Point(312, 288)
        Me.btnv.Name = "btnv"
        Me.btnv.Size = New System.Drawing.Size(32, 32)
        Me.btnv.TabIndex = 19
        Me.btnv.Text = "V"
        '
        'btnu
        '
        Me.btnu.Location = New System.Drawing.Point(280, 288)
        Me.btnu.Name = "btnu"
        Me.btnu.Size = New System.Drawing.Size(32, 32)
        Me.btnu.TabIndex = 20
        Me.btnu.Text = "U"
        '
        'btnt
        '
        Me.btnt.Location = New System.Drawing.Point(248, 288)
        Me.btnt.Name = "btnt"
        Me.btnt.Size = New System.Drawing.Size(32, 32)
        Me.btnt.TabIndex = 21
        Me.btnt.Text = "T"
        '
        'btns
        '
        Me.btns.Location = New System.Drawing.Point(216, 288)
        Me.btns.Name = "btns"
        Me.btns.Size = New System.Drawing.Size(32, 32)
        Me.btns.TabIndex = 22
        Me.btns.Text = "S"
        '
        'btnr
        '
        Me.btnr.Location = New System.Drawing.Point(184, 288)
        Me.btnr.Name = "btnr"
        Me.btnr.Size = New System.Drawing.Size(32, 32)
        Me.btnr.TabIndex = 23
        Me.btnr.Text = "R"
        '
        'btnq
        '
        Me.btnq.Location = New System.Drawing.Point(152, 288)
        Me.btnq.Name = "btnq"
        Me.btnq.Size = New System.Drawing.Size(32, 32)
        Me.btnq.TabIndex = 24
        Me.btnq.Text = "Q"
        '
        'btnp
        '
        Me.btnp.Location = New System.Drawing.Point(120, 288)
        Me.btnp.Name = "btnp"
        Me.btnp.Size = New System.Drawing.Size(32, 32)
        Me.btnp.TabIndex = 25
        Me.btnp.Text = "P"
        '
        'btno
        '
        Me.btno.Location = New System.Drawing.Point(88, 288)
        Me.btno.Name = "btno"
        Me.btno.Size = New System.Drawing.Size(32, 32)
        Me.btno.TabIndex = 26
        Me.btno.Text = "O"
        '
        'btnn
        '
        Me.btnn.Location = New System.Drawing.Point(56, 288)
        Me.btnn.Name = "btnn"
        Me.btnn.Size = New System.Drawing.Size(32, 32)
        Me.btnn.TabIndex = 27
        Me.btnn.Text = "N"
        '
        'btnz
        '
        Me.btnz.Location = New System.Drawing.Point(440, 288)
        Me.btnz.Name = "btnz"
        Me.btnz.Size = New System.Drawing.Size(32, 32)
        Me.btnz.TabIndex = 29
        Me.btnz.Text = "Z"
        '
        'Label2
        '
        Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.Location = New System.Drawing.Point(0, 48)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(144, 40)
        Me.Label2.TabIndex = 30
        Me.Label2.Text = "Win:"
        '
        'Label3
        '
        Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label3.Location = New System.Drawing.Point(0, 88)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(144, 40)
        Me.Label3.TabIndex = 31
        Me.Label3.Text = "Loss:"
        '
        'Label4
        '
        Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label4.Location = New System.Drawing.Point(0, 128)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(144, 40)
        Me.Label4.TabIndex = 32
        Me.Label4.Text = "Left:"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(512, 358)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label4, Me.Label3, Me.Label2, Me.btnz, Me.btnn, Me.btno, Me.btnp, Me.btnq, Me.btnr, Me.btns, Me.btnt, Me.btnu, Me.btnv, Me.btnw, Me.btnx, Me.btny, Me.btnb, Me.btnc, Me.btnd, Me.btne, Me.btnf, Me.btng, Me.btnh, Me.btni, Me.btnj, Me.btnk, Me.btnl, Me.btnm, Me.btna, Me.Button2, Me.Label1, Me.Button1})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim word As String
    Dim counter As Integer
    Dim length As Decimal
    Dim display As String
    Dim place As Integer










    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        word = GetNewWord("mm.txt")
        enable()
        Label1.Text = underscore(word.Length, "")

    End Sub

    Private Function underscore(ByVal wordlength As Integer, ByVal undscore As String) As String

        For wordlength = 0 To wordlength - 1
            undscore += "_ "
        Next

        Return undscore


    End Function


    Private Function check(ByVal letter As String, ByVal word1 As String, ByVal total As String, ByVal one As String, ByVal two As String)

        place = word.IndexOf(letter)
        If place = 0 Then
            word1 = Label1.Text
            one = word1.Substring(place)

            total = letter + " " + one
            Return total

        End If


        If place > 0 Then
            word1 = Label1.Text
            two = word1.Substring(0, place)
            one = word1.Substring(place)
            total = one + " " + letter + " " + two
            Return total
            Return Label1.Text - 1

        End If



    End Function



    Private Function enable()
        btna.Enabled = True
        btnb.Enabled = True
        btnc.Enabled = True
        btnd.Enabled = True
        btne.Enabled = True
        btnf.Enabled = True
        btng.Enabled = True
        btnh.Enabled = True
        btni.Enabled = True
        btnj.Enabled = True
        btnk.Enabled = True
        btnl.Enabled = True
        btnm.Enabled = True
        btnn.Enabled = True
        btno.Enabled = True
        btnp.Enabled = True
        btnq.Enabled = True
        btnr.Enabled = True
        btns.Enabled = True
        btnt.Enabled = True
        btnu.Enabled = True
        btnv.Enabled = True
        btnw.Enabled = True
        btnx.Enabled = True
        btny.Enabled = True
        btnz.Enabled = True
    End Function










    '----------------------------------------------------LETTER CLICK EVENTS--------------------------------------------------------------------
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btna.Click
        btna.Enabled = False
        Label1.Text = check("a", "", "", "", "")
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnb.Click
        btnb.Enabled = False
        Label1.Text = check("b", "", "", "", "")
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnc.Click
        btnc.Enabled = False
        Label1.Text = check("b", "", "", "", "")
    End Sub
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnd.Click
        btnd.Enabled = False
        Label1.Text = check("d", "", "", "", "")
    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btne.Click
        Label1.Text = check("e", "", "", "", "")
        btne.Enabled = False
    End Sub
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnf.Click
        check("f", "", "", "", "")
        btnf.Enabled = False
    End Sub
    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btng.Click
        Label1.Text = check("g", "", "", "", "")
        btng.Enabled = False
    End Sub
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnh.Click
        Label1.Text = check("h", "", "", "", "")
        btnh.Enabled = False
    End Sub
    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btni.Click
        Label1.Text = check("i", "", "", "", "")
        btni.Enabled = False
    End Sub
    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnj.Click
        Label1.Text = check("j", "", "", "", "")
        btnj.Enabled = False
    End Sub
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnk.Click
        Label1.Text = check("k", "", "", "", "")
        btnk.Enabled = False
    End Sub
    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnl.Click
        Label1.Text = check("l", "", "", "", "")
        btnl.Enabled = False
    End Sub
    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnm.Click
        Label1.Text = check("m", "", "", "", "")
        btnm.Enabled = False
    End Sub
    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnn.Click
        Label1.Text = check("n", "", "", "", "")
        btnn.Enabled = False
    End Sub
    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btno.Click
        Label1.Text = check("o", "", "", "", "")
        btno.Enabled = False
    End Sub
    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnp.Click
        Label1.Text = check("p", "", "", "", "")
        btnp.Enabled = False
    End Sub
    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnq.Click
        Label1.Text = check("q", "", "", "", "")
        btnq.Enabled = False
    End Sub
    Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnr.Click
        Label1.Text = check("r", "", "", "", "")
        btnr.Enabled = False
    End Sub
    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btns.Click
        Label1.Text = check("s", "", "", "", "")
        btns.Enabled = False
    End Sub
    Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnt.Click
        Label1.Text = check("t", "", "", "", "")
        btnt.Enabled = False
    End Sub
    Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnu.Click
        Label1.Text = check("u", "", "", "", "")
        btnu.Enabled = False
    End Sub
    Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnv.Click
        Label1.Text = check("v", "", "", "", "")
        btnv.Enabled = False
    End Sub
    Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnw.Click
        Label1.Text = check("w", "", "", "", "")
        btnw.Enabled = False
    End Sub
    Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnx.Click
        Label1.Text = check("x", "", "", "", "")
        btnx.Enabled = False
    End Sub
    Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btny.Click
        Label1.Text = check("y", "", "", "", "")
        btny.Enabled = False
    End Sub
    Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnz.Click
        Label1.Text = check("z", "", "", "", "")
        btnz.Enabled = False
    End Sub

    '--------------------------------------------------ABCDEFGHIJKLMNOPQRSTUVQXYZ-------------------------------------------------------------------


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
End Class

well.. here is what i have so far...

so far it displays underscores for the word length, it checks if the letter is in there, and if it is, displays it in the correct spot


now can anybody please help me do the counter, meaning, in a label it displays the number of letters remainig in the word, and should go down each time u get a letter right...

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents btna As System.Windows.Forms.Button
    Friend WithEvents btnm As System.Windows.Forms.Button
    Friend WithEvents btnl As System.Windows.Forms.Button
    Friend WithEvents btnk As System.Windows.Forms.Button
    Friend WithEvents btnj As System.Windows.Forms.Button
    Friend WithEvents btni As System.Windows.Forms.Button
    Friend WithEvents btng As System.Windows.Forms.Button
    Friend WithEvents btnf As System.Windows.Forms.Button
    Friend WithEvents btne As System.Windows.Forms.Button
    Friend WithEvents btnd As System.Windows.Forms.Button
    Friend WithEvents btnc As System.Windows.Forms.Button
    Friend WithEvents btnb As System.Windows.Forms.Button
    Friend WithEvents btnu As System.Windows.Forms.Button
    Friend WithEvents btnt As System.Windows.Forms.Button
    Friend WithEvents btns As System.Windows.Forms.Button
    Friend WithEvents btnr As System.Windows.Forms.Button
    Friend WithEvents btnq As System.Windows.Forms.Button
    Friend WithEvents btnp As System.Windows.Forms.Button
    Friend WithEvents btno As System.Windows.Forms.Button
    Friend WithEvents btnn As System.Windows.Forms.Button
    Friend WithEvents btny As System.Windows.Forms.Button
    Friend WithEvents btnx As System.Windows.Forms.Button
    Friend WithEvents btnw As System.Windows.Forms.Button
    Friend WithEvents btnv As System.Windows.Forms.Button
    Friend WithEvents btnz As System.Windows.Forms.Button
    Friend WithEvents btnh As System.Windows.Forms.Button
    Friend WithEvents btnstart As System.Windows.Forms.Button
    Friend WithEvents lbloutput As System.Windows.Forms.Label
    Friend WithEvents btnexit As System.Windows.Forms.Button
    Friend WithEvents lblwin As System.Windows.Forms.Label
    Friend WithEvents lblloss As System.Windows.Forms.Label
    Friend WithEvents lblleft As System.Windows.Forms.Label
    Friend WithEvents lblwin1 As System.Windows.Forms.Label
    Friend WithEvents lblleft1 As System.Windows.Forms.Label
    Friend WithEvents lblloss1 As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.btnstart = New System.Windows.Forms.Button()
        Me.lbloutput = New System.Windows.Forms.Label()
        Me.btnexit = New System.Windows.Forms.Button()
        Me.btna = New System.Windows.Forms.Button()
        Me.btnm = New System.Windows.Forms.Button()
        Me.btnl = New System.Windows.Forms.Button()
        Me.btnk = New System.Windows.Forms.Button()
        Me.btnj = New System.Windows.Forms.Button()
        Me.btni = New System.Windows.Forms.Button()
        Me.btnh = New System.Windows.Forms.Button()
        Me.btng = New System.Windows.Forms.Button()
        Me.btnf = New System.Windows.Forms.Button()
        Me.btne = New System.Windows.Forms.Button()
        Me.btnd = New System.Windows.Forms.Button()
        Me.btnc = New System.Windows.Forms.Button()
        Me.btnb = New System.Windows.Forms.Button()
        Me.btny = New System.Windows.Forms.Button()
        Me.btnx = New System.Windows.Forms.Button()
        Me.btnw = New System.Windows.Forms.Button()
        Me.btnv = New System.Windows.Forms.Button()
        Me.btnu = New System.Windows.Forms.Button()
        Me.btnt = New System.Windows.Forms.Button()
        Me.btns = New System.Windows.Forms.Button()
        Me.btnr = New System.Windows.Forms.Button()
        Me.btnq = New System.Windows.Forms.Button()
        Me.btnp = New System.Windows.Forms.Button()
        Me.btno = New System.Windows.Forms.Button()
        Me.btnn = New System.Windows.Forms.Button()
        Me.btnz = New System.Windows.Forms.Button()
        Me.lblwin = New System.Windows.Forms.Label()
        Me.lblloss = New System.Windows.Forms.Label()
        Me.lblleft = New System.Windows.Forms.Label()
        Me.lblwin1 = New System.Windows.Forms.Label()
        Me.lblleft1 = New System.Windows.Forms.Label()
        Me.lblloss1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'btnstart
        '
        Me.btnstart.Location = New System.Drawing.Point(8, 200)
        Me.btnstart.Name = "btnstart"
        Me.btnstart.Size = New System.Drawing.Size(80, 24)
        Me.btnstart.TabIndex = 0
        Me.btnstart.Text = "Start"
        '
        'lbloutput
        '
        Me.lbloutput.Location = New System.Drawing.Point(168, 208)
        Me.lbloutput.Name = "lbloutput"
        Me.lbloutput.Size = New System.Drawing.Size(232, 40)
        Me.lbloutput.TabIndex = 1
        '
        'btnexit
        '
        Me.btnexit.Location = New System.Drawing.Point(8, 224)
        Me.btnexit.Name = "btnexit"
        Me.btnexit.Size = New System.Drawing.Size(80, 24)
        Me.btnexit.TabIndex = 2
        Me.btnexit.Text = "Exit"
        '
        'btna
        '
        Me.btna.Enabled = False
        Me.btna.Location = New System.Drawing.Point(56, 256)
        Me.btna.Name = "btna"
        Me.btna.Size = New System.Drawing.Size(32, 32)
        Me.btna.TabIndex = 3
        Me.btna.Text = "A"
        '
        'btnm
        '
        Me.btnm.Enabled = False
        Me.btnm.Location = New System.Drawing.Point(440, 256)
        Me.btnm.Name = "btnm"
        Me.btnm.Size = New System.Drawing.Size(32, 32)
        Me.btnm.TabIndex = 4
        Me.btnm.Text = "M"
        '
        'btnl
        '
        Me.btnl.Enabled = False
        Me.btnl.Location = New System.Drawing.Point(408, 256)
        Me.btnl.Name = "btnl"
        Me.btnl.Size = New System.Drawing.Size(32, 32)
        Me.btnl.TabIndex = 5
        Me.btnl.Text = "L"
        '
        'btnk
        '
        Me.btnk.Enabled = False
        Me.btnk.Location = New System.Drawing.Point(376, 256)
        Me.btnk.Name = "btnk"
        Me.btnk.Size = New System.Drawing.Size(32, 32)
        Me.btnk.TabIndex = 6
        Me.btnk.Text = "K"
        '
        'btnj
        '
        Me.btnj.Enabled = False
        Me.btnj.Location = New System.Drawing.Point(344, 256)
        Me.btnj.Name = "btnj"
        Me.btnj.Size = New System.Drawing.Size(32, 32)
        Me.btnj.TabIndex = 7
        Me.btnj.Text = "J"
        '
        'btni
        '
        Me.btni.Enabled = False
        Me.btni.Location = New System.Drawing.Point(312, 256)
        Me.btni.Name = "btni"
        Me.btni.Size = New System.Drawing.Size(32, 32)
        Me.btni.TabIndex = 8
        Me.btni.Text = "I"
        '
        'btnh
        '
        Me.btnh.Enabled = False
        Me.btnh.Location = New System.Drawing.Point(280, 256)
        Me.btnh.Name = "btnh"
        Me.btnh.Size = New System.Drawing.Size(32, 32)
        Me.btnh.TabIndex = 9
        Me.btnh.Text = "H"
        '
        'btng
        '
        Me.btng.Enabled = False
        Me.btng.Location = New System.Drawing.Point(248, 256)
        Me.btng.Name = "btng"
        Me.btng.Size = New System.Drawing.Size(32, 32)
        Me.btng.TabIndex = 10
        Me.btng.Text = "G"
        '
        'btnf
        '
        Me.btnf.Enabled = False
        Me.btnf.Location = New System.Drawing.Point(216, 256)
        Me.btnf.Name = "btnf"
        Me.btnf.Size = New System.Drawing.Size(32, 32)
        Me.btnf.TabIndex = 11
        Me.btnf.Text = "F"
        '
        'btne
        '
        Me.btne.Enabled = False
        Me.btne.Location = New System.Drawing.Point(184, 256)
        Me.btne.Name = "btne"
        Me.btne.Size = New System.Drawing.Size(32, 32)
        Me.btne.TabIndex = 12
        Me.btne.Text = "E"
        '
        'btnd
        '
        Me.btnd.Enabled = False
        Me.btnd.Location = New System.Drawing.Point(152, 256)
        Me.btnd.Name = "btnd"
        Me.btnd.Size = New System.Drawing.Size(32, 32)
        Me.btnd.TabIndex = 13
        Me.btnd.Text = "D"
        '
        'btnc
        '
        Me.btnc.Enabled = False
        Me.btnc.Location = New System.Drawing.Point(120, 256)
        Me.btnc.Name = "btnc"
        Me.btnc.Size = New System.Drawing.Size(32, 32)
        Me.btnc.TabIndex = 14
        Me.btnc.Text = "C"
        '
        'btnb
        '
        Me.btnb.Enabled = False
        Me.btnb.Location = New System.Drawing.Point(88, 256)
        Me.btnb.Name = "btnb"
        Me.btnb.Size = New System.Drawing.Size(32, 32)
        Me.btnb.TabIndex = 15
        Me.btnb.Text = "B"
        '
        'btny
        '
        Me.btny.Enabled = False
        Me.btny.Location = New System.Drawing.Point(408, 288)
        Me.btny.Name = "btny"
        Me.btny.Size = New System.Drawing.Size(32, 32)
        Me.btny.TabIndex = 16
        Me.btny.Text = "Y"
        '
        'btnx
        '
        Me.btnx.Enabled = False
        Me.btnx.Location = New System.Drawing.Point(376, 288)
        Me.btnx.Name = "btnx"
        Me.btnx.Size = New System.Drawing.Size(32, 32)
        Me.btnx.TabIndex = 17
        Me.btnx.Text = "X"
        '
        'btnw
        '
        Me.btnw.Enabled = False
        Me.btnw.Location = New System.Drawing.Point(344, 288)
        Me.btnw.Name = "btnw"
        Me.btnw.Size = New System.Drawing.Size(32, 32)
        Me.btnw.TabIndex = 18
        Me.btnw.Text = "W"
        '
        'btnv
        '
        Me.btnv.Enabled = False
        Me.btnv.Location = New System.Drawing.Point(312, 288)
        Me.btnv.Name = "btnv"
        Me.btnv.Size = New System.Drawing.Size(32, 32)
        Me.btnv.TabIndex = 19
        Me.btnv.Text = "V"
        '
        'btnu
        '
        Me.btnu.Enabled = False
        Me.btnu.Location = New System.Drawing.Point(280, 288)
        Me.btnu.Name = "btnu"
        Me.btnu.Size = New System.Drawing.Size(32, 32)
        Me.btnu.TabIndex = 20
        Me.btnu.Text = "U"
        '
        'btnt
        '
        Me.btnt.Enabled = False
        Me.btnt.Location = New System.Drawing.Point(248, 288)
        Me.btnt.Name = "btnt"
        Me.btnt.Size = New System.Drawing.Size(32, 32)
        Me.btnt.TabIndex = 21
        Me.btnt.Text = "T"
        '
        'btns
        '
        Me.btns.Enabled = False
        Me.btns.Location = New System.Drawing.Point(216, 288)
        Me.btns.Name = "btns"
        Me.btns.Size = New System.Drawing.Size(32, 32)
        Me.btns.TabIndex = 22
        Me.btns.Text = "S"
        '
        'btnr
        '
        Me.btnr.Enabled = False
        Me.btnr.Location = New System.Drawing.Point(184, 288)
        Me.btnr.Name = "btnr"
        Me.btnr.Size = New System.Drawing.Size(32, 32)
        Me.btnr.TabIndex = 23
        Me.btnr.Text = "R"
        '
        'btnq
        '
        Me.btnq.Enabled = False
        Me.btnq.Location = New System.Drawing.Point(152, 288)
        Me.btnq.Name = "btnq"
        Me.btnq.Size = New System.Drawing.Size(32, 32)
        Me.btnq.TabIndex = 24
        Me.btnq.Text = "Q"
        '
        'btnp
        '
        Me.btnp.Enabled = False
        Me.btnp.Location = New System.Drawing.Point(120, 288)
        Me.btnp.Name = "btnp"
        Me.btnp.Size = New System.Drawing.Size(32, 32)
        Me.btnp.TabIndex = 25
        Me.btnp.Text = "P"
        '
        'btno
        '
        Me.btno.Enabled = False
        Me.btno.Location = New System.Drawing.Point(88, 288)
        Me.btno.Name = "btno"
        Me.btno.Size = New System.Drawing.Size(32, 32)
        Me.btno.TabIndex = 26
        Me.btno.Text = "O"
        '
        'btnn
        '
        Me.btnn.Enabled = False
        Me.btnn.Location = New System.Drawing.Point(56, 288)
        Me.btnn.Name = "btnn"
        Me.btnn.Size = New System.Drawing.Size(32, 32)
        Me.btnn.TabIndex = 27
        Me.btnn.Text = "N"
        '
        'btnz
        '
        Me.btnz.Enabled = False
        Me.btnz.Location = New System.Drawing.Point(440, 288)
        Me.btnz.Name = "btnz"
        Me.btnz.Size = New System.Drawing.Size(32, 32)
        Me.btnz.TabIndex = 29
        Me.btnz.Text = "Z"
        '
        'lblwin
        '
        Me.lblwin.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblwin.Location = New System.Drawing.Point(0, 48)
        Me.lblwin.Name = "lblwin"
        Me.lblwin.Size = New System.Drawing.Size(144, 40)
        Me.lblwin.TabIndex = 30
        Me.lblwin.Text = "Win:"
        '
        'lblloss
        '
        Me.lblloss.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblloss.Location = New System.Drawing.Point(0, 88)
        Me.lblloss.Name = "lblloss"
        Me.lblloss.Size = New System.Drawing.Size(144, 40)
        Me.lblloss.TabIndex = 31
        Me.lblloss.Text = "Loss:"
        '
        'lblleft
        '
        Me.lblleft.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblleft.Location = New System.Drawing.Point(0, 128)
        Me.lblleft.Name = "lblleft"
        Me.lblleft.Size = New System.Drawing.Size(144, 40)
        Me.lblleft.TabIndex = 32
        Me.lblleft.Text = "Left:"
        '
        'lblwin1
        '
        Me.lblwin1.Location = New System.Drawing.Point(152, 48)
        Me.lblwin1.Name = "lblwin1"
        Me.lblwin1.Size = New System.Drawing.Size(64, 40)
        Me.lblwin1.TabIndex = 33
        '
        'lblleft1
        '
        Me.lblleft1.Location = New System.Drawing.Point(152, 128)
        Me.lblleft1.Name = "lblleft1"
        Me.lblleft1.Size = New System.Drawing.Size(64, 40)
        Me.lblleft1.TabIndex = 34
        '
        'lblloss1
        '
        Me.lblloss1.Location = New System.Drawing.Point(152, 88)
        Me.lblloss1.Name = "lblloss1"
        Me.lblloss1.Size = New System.Drawing.Size(64, 40)
        Me.lblloss1.TabIndex = 35
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(512, 358)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblloss1, Me.lblleft1, Me.lblwin1, Me.lblleft, Me.lblloss, Me.lblwin, Me.btnz, Me.btnn, Me.btno, Me.btnp, Me.btnq, Me.btnr, Me.btns, Me.btnt, Me.btnu, Me.btnv, Me.btnw, Me.btnx, Me.btny, Me.btnb, Me.btnc, Me.btnd, Me.btne, Me.btnf, Me.btng, Me.btnh, Me.btni, Me.btnj, Me.btnk, Me.btnl, Me.btnm, Me.btna, Me.btnexit, Me.lbloutput, Me.btnstart})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim word As String
    Dim counter As Integer
    Dim length As Decimal
    Dim display As String
    Dim place As Integer










    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnstart.Click

        word = GetNewWord("mm.txt")
        word = word.ToUpper
        enable()
        lbloutput.Text = underscore(word.Length, "")
        lblleft1.Text = word.Length


    End Sub

    Private Function underscore(ByVal wordlength As Integer, ByVal undscore As String) As String

        For wordlength = 0 To wordlength - 1
            undscore += "_ "
        Next

        Return undscore


    End Function


    Private Function check(ByVal letter As String, ByVal word1 As String, ByVal total As String, ByVal one As String, ByVal two As String)
        place = word.IndexOf(letter)
        If place = 0 Then
            word1 = lbloutput.Text
            one = word1.Substring(place * 2 + 1)
            total = letter + one
            Return total
        End If


        If place > 0 Then
            word1 = lbloutput.Text
            two = word1.Substring(0, place * 2)
            one = word1.Substring(place * 2 + 1)
            total = two + letter + one
            Return total
        End If

        If place < 0 Then
            MessageBox.Show("hi")
            Return lbloutput.Text
        End If

        'THIS IS THE COUNTER THAT I NEED HELP WITH
        'If place >= 0 Then
        '    lblleft1.Text = word.Length & counter
        'End If


    End Function

  

    Private Function enable()
        btna.Enabled = True
        btnb.Enabled = True
        btnc.Enabled = True
        btnd.Enabled = True
        btne.Enabled = True
        btnf.Enabled = True
        btng.Enabled = True
        btnh.Enabled = True
        btni.Enabled = True
        btnj.Enabled = True
        btnk.Enabled = True
        btnl.Enabled = True
        btnm.Enabled = True
        btnn.Enabled = True
        btno.Enabled = True
        btnp.Enabled = True
        btnq.Enabled = True
        btnr.Enabled = True
        btns.Enabled = True
        btnt.Enabled = True
        btnu.Enabled = True
        btnv.Enabled = True
        btnw.Enabled = True
        btnx.Enabled = True
        btny.Enabled = True
        btnz.Enabled = True
    End Function










    '----------------------------------------------------LETTER CLICK EVENTS--------------------------------------------------------------------
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btna.Click
        btna.Enabled = False
        lbloutput.Text = check("A", "", "", "", "")
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnb.Click
        btnb.Enabled = False
        lbloutput.Text = check("B", "", "", "", "")
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnc.Click
        btnc.Enabled = False
        lbloutput.Text = check("C", "", "", "", "")
    End Sub
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnd.Click
        btnd.Enabled = False
        lbloutput.Text = check("D", "", "", "", "")
    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btne.Click
        lbloutput.Text = check("E", "", "", "", "")
        btne.Enabled = False
    End Sub
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnf.Click
        lbloutput.Text = check("F", "", "", "", "")
        btnf.Enabled = False
    End Sub
    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btng.Click
        lbloutput.Text = check("G", "", "", "", "")
        btng.Enabled = False
    End Sub
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnh.Click
        lbloutput.Text = check("H", "", "", "", "")
        btnh.Enabled = False
    End Sub
    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btni.Click
        lbloutput.Text = check("I", "", "", "", "")
        btni.Enabled = False
    End Sub
    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnj.Click
        lbloutput.Text = check("J", "", "", "", "")
        btnj.Enabled = False
    End Sub
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnk.Click
        lbloutput.Text = check("K", "", "", "", "")
        btnk.Enabled = False
    End Sub
    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnl.Click
        lbloutput.Text = check("L", "", "", "", "")
        btnl.Enabled = False
    End Sub
    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnm.Click
        lbloutput.Text = check("M", "", "", "", "")
        btnm.Enabled = False
    End Sub
    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnn.Click
        lbloutput.Text = check("N", "", "", "", "")
        btnn.Enabled = False
    End Sub
    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btno.Click
        lbloutput.Text = check("O", "", "", "", "")
        btno.Enabled = False
    End Sub
    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnp.Click
        lbloutput.Text = check("P", "", "", "", "")
        btnp.Enabled = False
    End Sub
    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnq.Click
        lbloutput.Text = check("Q", "", "", "", "")
        btnq.Enabled = False
    End Sub
    Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnr.Click
        lbloutput.Text = check("R", "", "", "", "")
        btnr.Enabled = False
    End Sub
    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btns.Click
        lbloutput.Text = check("S", "", "", "", "")
        btns.Enabled = False
    End Sub
    Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnt.Click
        lbloutput.Text = check("T", "", "", "", "")
        btnt.Enabled = False
    End Sub
    Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnu.Click
        lbloutput.Text = check("U", "", "", "", "")
        btnu.Enabled = False
    End Sub
    Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnv.Click
        lbloutput.Text = check("V", "", "", "", "")
        btnv.Enabled = False
    End Sub
    Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnw.Click
        lbloutput.Text = check("W", "", "", "", "")
        btnw.Enabled = False
    End Sub
    Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnx.Click
        lbloutput.Text = check("X", "", "", "", "")
        btnx.Enabled = False
    End Sub
    Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btny.Click
        lbloutput.Text = check("Y", "", "", "", "")
        btny.Enabled = False
    End Sub
    Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnz.Click
        lbloutput.Text = check("Z", "", "", "", "")
        btnz.Enabled = False
    End Sub

    '--------------------------------------------------ABCDEFGHIJKLMNOPQRSTUVQXYZ-------------------------------------------------------------------


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
        Me.Close()
    End Sub
End Class

Ive programmed in VB for a LONG time but the vb.net code I see is a bit more complex, even some c/c++ inspiration in it! However i had a look at what you are trying to do. When you say the number of letters in the word do you mean individual letters or multiple letters for example

the word is "missed" and the user has got mi___d

would you like to print 2 (e and s missing)
or would you like to get 3 (e and two esses missing)

I assumed you are after recognising the individual letters (the first option). I would still use a boolean array for each letter (26). When you get the word from the file you need to have a temp array of 26 booleans, then go through each letter in the word, setting the appropriate index in the temp array to true (therefore multiple letters wont get counted twice as they have the same index), then going through the ARRAY and counting the number of 'true' states. This gives you the number of different letters in the word. When the user makes a correct guess, decrement this number.

Example:

the word is excited

our array is full of boolean falses (dim letters(25) as boolean or whatever)
we go through the word and get e, so we set letters(4) to true
we go through the word and get x, so we set letters(23) to true
we go through the word and get c, so we set letters(2) to true
we go through the word and get i, so we set letters(8) to true
we go through the word and get t, so we set letters(19) to true
we go through the word and get e, so we set letters(4) to true 'the duplicate e doesnt matter
we go through the word and get d, so we set letters(3) to true

so the array looks a bit like this

a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0

we have 6 true states so there are 6 different letters in the word 'excited', when we get a correct guess we take one from this number so after the user has got:

ex__te_ we have 3 letters left (c, d, and i)

Ive programmed in VB for a LONG time but the vb.net code I see is a bit more complex, even some c/c++ inspiration in it! However i had a look at what you are trying to do. When you say the number of letters in the word do you mean individual letters or multiple letters for example

the word is "missed" and the user has got mi___d

would you like to print 2 (e and s missing)
or would you like to get 3 (e and two esses missing)

I assumed you are after recognising the individual letters (the first option). I would still use a boolean array for each letter (26). When you get the word from the file you need to have a temp array of 26 booleans, then go through each letter in the word, setting the appropriate index in the temp array to true (therefore multiple letters wont get counted twice as they have the same index), then going through the ARRAY and counting the number of 'true' states. This gives you the number of different letters in the word. When the user makes a correct guess, decrement this number.

Example:

the word is excited

our array is full of boolean falses (dim letters(25) as boolean or whatever)
we go through the word and get e, so we set letters(4) to true
we go through the word and get x, so we set letters(23) to true
we go through the word and get c, so we set letters(2) to true
we go through the word and get i, so we set letters(8) to true
we go through the word and get t, so we set letters(19) to true
we go through the word and get e, so we set letters(4) to true 'the duplicate e doesnt matter
we go through the word and get d, so we set letters(3) to true

so the array looks a bit like this

a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0

we have 6 true states so there are 6 different letters in the word 'excited', when we get a correct guess we take one from this number so after the user has got:

ex__te_ we have 3 letters left (c, d, and i)

i'm very sorry to say this.. because u actually tried helping me.. but in school we havnt learned about arrays yet.. i bet if we had this would have helped tremendously..

sry for ure trouble, but is there any other way to do this :-D?

not without arrays unless you want to store a LOT of variables!

actually there is one other way i can think of.
Rearrange word alphabetically.
we start be having the number of letters = 1
Instead of the array, store the current string letter and the next
if the next is not the same as the current (ie not a repeated character) increment the number of letters ie

word = test
word goes to estt (alphabetical)
we have one letter

current letter = e
next letter = s
not the same so we have 2 letters (add)
current letter = s
next letter = t
not the same so we have 3 letters (add)
current letter = t
next letter = t
skip

Result = 3 letters in "test" (e, s and t)

A little bit about arrays
----------------------

instead of storing large numbers of variables you can group together some variables in a list called an array (its easier to show you than explain). Each array is of a certain type (array of strings, array of integers ect...) and has a name to identify it

example

Dim test(4) as integer ' this is an array (list) of 5 integers

The number in the brackets is the size of your array (list). In the above example i wanted a list of 5 integers called "test" -> however we have to put a 4 in the brackets!!! (see below)

An array is a list in memory, so each item in the list will be obviously the same 'distance' from one another in memory addresses because they are the same type!

ie

test item 1: mem address x
test item 2: mem address x + (the space of an integer)
test item 3: ...
test item 4: ...
test item 5: ...

so when you specify an index (number in the brackets) you MUST remember that the first element (item) is at address + 0! so the numbering starts from 0, clever that!

Dim prices(9) as currency ' a list of 10 prices as currency variables

prices(0) = 33.28 ' put 33.28 into the first item
prices(5) = 15.00 ' put 15.00 into the 6th item

Dim x as currency

x = prices(4) ' get the data from the 5th item and put it in x (make sure the types match!)

A google search will find someone who can explain arrays MUCH better that I can! arrays also go hand in hand with loops so that may be another area to look up if you do not know loops either!

Big Problem!!!
ok hangman all worked perfectly... then suddenly this erro came up!!!

SOMEBODY HELP ME PLEASE THIS IS DUE 2MORROW!!!

ERROR = An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in system.windows.forms.dll

Additional information: A generic error occurred in GDI+.

Public Class form1
    Inherits System.Windows.Forms.Form
    '      Author:  Misha Mitsnefes 

    'Completed On:  1/4/05

    'Program Name: Hang the Coyote  

    'Folder Names: Hang the Coyote

    'Description: This is the original hangman game with a little twist, instead of hanging a stick figure, you slowly flip the switch of the electric chair untill the coyote is fried:).

    '                            E V A L U A T I O N

    '               Pseudocode  ____ (10)       User Friendly  ____ (10)

    '       Proper Indentation  ____ ( 5)   Program Structure  ____ (10)

    'Descriptive Variable Names ____ ( 5)       Functionality  ____ (50)

    '            Documentation  ____ (10)     Bonus/(Penalty)  ____ ( ?)

    '                            Total  ____ (100)

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents btna As System.Windows.Forms.Button
    Friend WithEvents btnm As System.Windows.Forms.Button
    Friend WithEvents btnl As System.Windows.Forms.Button
    Friend WithEvents btnk As System.Windows.Forms.Button
    Friend WithEvents btnj As System.Windows.Forms.Button
    Friend WithEvents btni As System.Windows.Forms.Button
    Friend WithEvents btng As System.Windows.Forms.Button
    Friend WithEvents btnf As System.Windows.Forms.Button
    Friend WithEvents btne As System.Windows.Forms.Button
    Friend WithEvents btnd As System.Windows.Forms.Button
    Friend WithEvents btnc As System.Windows.Forms.Button
    Friend WithEvents btnb As System.Windows.Forms.Button
    Friend WithEvents btnu As System.Windows.Forms.Button
    Friend WithEvents btnt As System.Windows.Forms.Button
    Friend WithEvents btns As System.Windows.Forms.Button
    Friend WithEvents btnr As System.Windows.Forms.Button
    Friend WithEvents btnq As System.Windows.Forms.Button
    Friend WithEvents btnp As System.Windows.Forms.Button
    Friend WithEvents btno As System.Windows.Forms.Button
    Friend WithEvents btnn As System.Windows.Forms.Button
    Friend WithEvents btny As System.Windows.Forms.Button
    Friend WithEvents btnx As System.Windows.Forms.Button
    Friend WithEvents btnw As System.Windows.Forms.Button
    Friend WithEvents btnv As System.Windows.Forms.Button
    Friend WithEvents btnz As System.Windows.Forms.Button
    Friend WithEvents btnh As System.Windows.Forms.Button
    Friend WithEvents btnstart As System.Windows.Forms.Button
    Friend WithEvents lbloutput As System.Windows.Forms.Label
    Friend WithEvents btnexit As System.Windows.Forms.Button
    Friend WithEvents lblwin As System.Windows.Forms.Label
    Friend WithEvents lblloss As System.Windows.Forms.Label
    Friend WithEvents lblwin1 As System.Windows.Forms.Label
    Friend WithEvents lblloss1 As System.Windows.Forms.Label
    Friend WithEvents lblguesses1 As System.Windows.Forms.Label
    Friend WithEvents lblguesses As System.Windows.Forms.Label
    Friend WithEvents lblmisses1 As System.Windows.Forms.Label
    Friend WithEvents lblmisses As System.Windows.Forms.Label
    Friend WithEvents lbllefty As System.Windows.Forms.Label
    Friend WithEvents lbllefty1 As System.Windows.Forms.Label
    Friend WithEvents picturebox As System.Windows.Forms.PictureBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(form1))
        Me.btnstart = New System.Windows.Forms.Button()
        Me.lbloutput = New System.Windows.Forms.Label()
        Me.btnexit = New System.Windows.Forms.Button()
        Me.btna = New System.Windows.Forms.Button()
        Me.btnm = New System.Windows.Forms.Button()
        Me.btnl = New System.Windows.Forms.Button()
        Me.btnk = New System.Windows.Forms.Button()
        Me.btnj = New System.Windows.Forms.Button()
        Me.btni = New System.Windows.Forms.Button()
        Me.btnh = New System.Windows.Forms.Button()
        Me.btng = New System.Windows.Forms.Button()
        Me.btnf = New System.Windows.Forms.Button()
        Me.btne = New System.Windows.Forms.Button()
        Me.btnd = New System.Windows.Forms.Button()
        Me.btnc = New System.Windows.Forms.Button()
        Me.btnb = New System.Windows.Forms.Button()
        Me.btny = New System.Windows.Forms.Button()
        Me.btnx = New System.Windows.Forms.Button()
        Me.btnw = New System.Windows.Forms.Button()
        Me.btnv = New System.Windows.Forms.Button()
        Me.btnu = New System.Windows.Forms.Button()
        Me.btnt = New System.Windows.Forms.Button()
        Me.btns = New System.Windows.Forms.Button()
        Me.btnr = New System.Windows.Forms.Button()
        Me.btnq = New System.Windows.Forms.Button()
        Me.btnp = New System.Windows.Forms.Button()
        Me.btno = New System.Windows.Forms.Button()
        Me.btnn = New System.Windows.Forms.Button()
        Me.btnz = New System.Windows.Forms.Button()
        Me.lblwin = New System.Windows.Forms.Label()
        Me.lblloss = New System.Windows.Forms.Label()
        Me.lbllefty = New System.Windows.Forms.Label()
        Me.lblwin1 = New System.Windows.Forms.Label()
        Me.lbllefty1 = New System.Windows.Forms.Label()
        Me.lblloss1 = New System.Windows.Forms.Label()
        Me.lblguesses1 = New System.Windows.Forms.Label()
        Me.lblguesses = New System.Windows.Forms.Label()
        Me.lblmisses1 = New System.Windows.Forms.Label()
        Me.lblmisses = New System.Windows.Forms.Label()
        Me.picturebox = New System.Windows.Forms.PictureBox()
        Me.SuspendLayout()
        '
        'btnstart
        '
        Me.btnstart.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnstart.ForeColor = System.Drawing.Color.Firebrick
        Me.btnstart.Location = New System.Drawing.Point(48, 328)
        Me.btnstart.Name = "btnstart"
        Me.btnstart.Size = New System.Drawing.Size(80, 24)
        Me.btnstart.TabIndex = 0
        Me.btnstart.Text = "Start"
        '
        'lbloutput
        '
        Me.lbloutput.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbloutput.ForeColor = System.Drawing.Color.Firebrick
        Me.lbloutput.Location = New System.Drawing.Point(200, 328)
        Me.lbloutput.Name = "lbloutput"
        Me.lbloutput.Size = New System.Drawing.Size(408, 40)
        Me.lbloutput.TabIndex = 1
        Me.lbloutput.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'btnexit
        '
        Me.btnexit.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnexit.ForeColor = System.Drawing.Color.Firebrick
        Me.btnexit.Location = New System.Drawing.Point(672, 328)
        Me.btnexit.Name = "btnexit"
        Me.btnexit.Size = New System.Drawing.Size(80, 24)
        Me.btnexit.TabIndex = 2
        Me.btnexit.Text = "Exit"
        '
        'btna
        '
        Me.btna.Enabled = False
        Me.btna.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btna.ForeColor = System.Drawing.Color.Firebrick
        Me.btna.Location = New System.Drawing.Point(192, 384)
        Me.btna.Name = "btna"
        Me.btna.Size = New System.Drawing.Size(32, 32)
        Me.btna.TabIndex = 3
        Me.btna.Text = "A"
        '
        'btnm
        '
        Me.btnm.Enabled = False
        Me.btnm.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnm.ForeColor = System.Drawing.Color.Firebrick
        Me.btnm.Location = New System.Drawing.Point(576, 384)
        Me.btnm.Name = "btnm"
        Me.btnm.Size = New System.Drawing.Size(32, 32)
        Me.btnm.TabIndex = 4
        Me.btnm.Text = "M"
        '
        'btnl
        '
        Me.btnl.Enabled = False
        Me.btnl.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnl.ForeColor = System.Drawing.Color.Firebrick
        Me.btnl.Location = New System.Drawing.Point(544, 384)
        Me.btnl.Name = "btnl"
        Me.btnl.Size = New System.Drawing.Size(32, 32)
        Me.btnl.TabIndex = 5
        Me.btnl.Text = "L"
        '
        'btnk
        '
        Me.btnk.Enabled = False
        Me.btnk.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnk.ForeColor = System.Drawing.Color.Firebrick
        Me.btnk.Location = New System.Drawing.Point(512, 384)
        Me.btnk.Name = "btnk"
        Me.btnk.Size = New System.Drawing.Size(32, 32)
        Me.btnk.TabIndex = 6
        Me.btnk.Text = "K"
        '
        'btnj
        '
        Me.btnj.Enabled = False
        Me.btnj.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnj.ForeColor = System.Drawing.Color.Firebrick
        Me.btnj.Location = New System.Drawing.Point(480, 384)
        Me.btnj.Name = "btnj"
        Me.btnj.Size = New System.Drawing.Size(32, 32)
        Me.btnj.TabIndex = 7
        Me.btnj.Text = "J"
        '
        'btni
        '
        Me.btni.Enabled = False
        Me.btni.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btni.ForeColor = System.Drawing.Color.Firebrick
        Me.btni.Location = New System.Drawing.Point(448, 384)
        Me.btni.Name = "btni"
        Me.btni.Size = New System.Drawing.Size(32, 32)
        Me.btni.TabIndex = 8
        Me.btni.Text = "I"
        '
        'btnh
        '
        Me.btnh.Enabled = False
        Me.btnh.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnh.ForeColor = System.Drawing.Color.Firebrick
        Me.btnh.Location = New System.Drawing.Point(416, 384)
        Me.btnh.Name = "btnh"
        Me.btnh.Size = New System.Drawing.Size(32, 32)
        Me.btnh.TabIndex = 9
        Me.btnh.Text = "H"
        '
        'btng
        '
        Me.btng.Enabled = False
        Me.btng.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btng.ForeColor = System.Drawing.Color.Firebrick
        Me.btng.Location = New System.Drawing.Point(384, 384)
        Me.btng.Name = "btng"
        Me.btng.Size = New System.Drawing.Size(32, 32)
        Me.btng.TabIndex = 10
        Me.btng.Text = "G"
        '
        'btnf
        '
        Me.btnf.Enabled = False
        Me.btnf.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnf.ForeColor = System.Drawing.Color.Firebrick
        Me.btnf.Location = New System.Drawing.Point(352, 384)
        Me.btnf.Name = "btnf"
        Me.btnf.Size = New System.Drawing.Size(32, 32)
        Me.btnf.TabIndex = 11
        Me.btnf.Text = "F"
        '
        'btne
        '
        Me.btne.Enabled = False
        Me.btne.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btne.ForeColor = System.Drawing.Color.Firebrick
        Me.btne.Location = New System.Drawing.Point(320, 384)
        Me.btne.Name = "btne"
        Me.btne.Size = New System.Drawing.Size(32, 32)
        Me.btne.TabIndex = 12
        Me.btne.Text = "E"
        '
        'btnd
        '
        Me.btnd.Enabled = False
        Me.btnd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnd.ForeColor = System.Drawing.Color.Firebrick
        Me.btnd.Location = New System.Drawing.Point(288, 384)
        Me.btnd.Name = "btnd"
        Me.btnd.Size = New System.Drawing.Size(32, 32)
        Me.btnd.TabIndex = 13
        Me.btnd.Text = "D"
        '
        'btnc
        '
        Me.btnc.Enabled = False
        Me.btnc.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnc.ForeColor = System.Drawing.Color.Firebrick
        Me.btnc.Location = New System.Drawing.Point(256, 384)
        Me.btnc.Name = "btnc"
        Me.btnc.Size = New System.Drawing.Size(32, 32)
        Me.btnc.TabIndex = 14
        Me.btnc.Text = "C"
        '
        'btnb
        '
        Me.btnb.Enabled = False
        Me.btnb.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnb.ForeColor = System.Drawing.Color.Firebrick
        Me.btnb.Location = New System.Drawing.Point(224, 384)
        Me.btnb.Name = "btnb"
        Me.btnb.Size = New System.Drawing.Size(32, 32)
        Me.btnb.TabIndex = 15
        Me.btnb.Text = "B"
        '
        'btny
        '
        Me.btny.Enabled = False
        Me.btny.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btny.ForeColor = System.Drawing.Color.Firebrick
        Me.btny.Location = New System.Drawing.Point(544, 416)
        Me.btny.Name = "btny"
        Me.btny.Size = New System.Drawing.Size(32, 32)
        Me.btny.TabIndex = 16
        Me.btny.Text = "Y"
        '
        'btnx
        '
        Me.btnx.Enabled = False
        Me.btnx.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnx.ForeColor = System.Drawing.Color.Firebrick
        Me.btnx.Location = New System.Drawing.Point(512, 416)
        Me.btnx.Name = "btnx"
        Me.btnx.Size = New System.Drawing.Size(32, 32)
        Me.btnx.TabIndex = 17
        Me.btnx.Text = "X"
        '
        'btnw
        '
        Me.btnw.Enabled = False
        Me.btnw.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnw.ForeColor = System.Drawing.Color.Firebrick
        Me.btnw.Location = New System.Drawing.Point(480, 416)
        Me.btnw.Name = "btnw"
        Me.btnw.Size = New System.Drawing.Size(32, 32)
        Me.btnw.TabIndex = 18
        Me.btnw.Text = "W"
        '
        'btnv
        '
        Me.btnv.Enabled = False
        Me.btnv.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnv.ForeColor = System.Drawing.Color.Firebrick
        Me.btnv.Location = New System.Drawing.Point(448, 416)
        Me.btnv.Name = "btnv"
        Me.btnv.Size = New System.Drawing.Size(32, 32)
        Me.btnv.TabIndex = 19
        Me.btnv.Text = "V"
        '
        'btnu
        '
        Me.btnu.Enabled = False
        Me.btnu.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnu.ForeColor = System.Drawing.Color.Firebrick
        Me.btnu.Location = New System.Drawing.Point(416, 416)
        Me.btnu.Name = "btnu"
        Me.btnu.Size = New System.Drawing.Size(32, 32)
        Me.btnu.TabIndex = 20
        Me.btnu.Text = "U"
        '
        'btnt
        '
        Me.btnt.Enabled = False
        Me.btnt.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnt.ForeColor = System.Drawing.Color.Firebrick
        Me.btnt.Location = New System.Drawing.Point(384, 416)
        Me.btnt.Name = "btnt"
        Me.btnt.Size = New System.Drawing.Size(32, 32)
        Me.btnt.TabIndex = 21
        Me.btnt.Text = "T"
        '
        'btns
        '
        Me.btns.Enabled = False
        Me.btns.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btns.ForeColor = System.Drawing.Color.Firebrick
        Me.btns.Location = New System.Drawing.Point(352, 416)
        Me.btns.Name = "btns"
        Me.btns.Size = New System.Drawing.Size(32, 32)
        Me.btns.TabIndex = 22
        Me.btns.Text = "S"
        '
        'btnr
        '
        Me.btnr.Enabled = False
        Me.btnr.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnr.ForeColor = System.Drawing.Color.Firebrick
        Me.btnr.Location = New System.Drawing.Point(320, 416)
        Me.btnr.Name = "btnr"
        Me.btnr.Size = New System.Drawing.Size(32, 32)
        Me.btnr.TabIndex = 23
        Me.btnr.Text = "R"
        '
        'btnq
        '
        Me.btnq.Enabled = False
        Me.btnq.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnq.ForeColor = System.Drawing.Color.Firebrick
        Me.btnq.Location = New System.Drawing.Point(288, 416)
        Me.btnq.Name = "btnq"
        Me.btnq.Size = New System.Drawing.Size(32, 32)
        Me.btnq.TabIndex = 24
        Me.btnq.Text = "Q"
        '
        'btnp
        '
        Me.btnp.Enabled = False
        Me.btnp.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnp.ForeColor = System.Drawing.Color.Firebrick
        Me.btnp.Location = New System.Drawing.Point(256, 416)
        Me.btnp.Name = "btnp"
        Me.btnp.Size = New System.Drawing.Size(32, 32)
        Me.btnp.TabIndex = 25
        Me.btnp.Text = "P"
        '
        'btno
        '
        Me.btno.Enabled = False
        Me.btno.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btno.ForeColor = System.Drawing.Color.Firebrick
        Me.btno.Location = New System.Drawing.Point(224, 416)
        Me.btno.Name = "btno"
        Me.btno.Size = New System.Drawing.Size(32, 32)
        Me.btno.TabIndex = 26
        Me.btno.Text = "O"
        '
        'btnn
        '
        Me.btnn.Enabled = False
        Me.btnn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnn.ForeColor = System.Drawing.Color.Firebrick
        Me.btnn.Location = New System.Drawing.Point(192, 416)
        Me.btnn.Name = "btnn"
        Me.btnn.Size = New System.Drawing.Size(32, 32)
        Me.btnn.TabIndex = 27
        Me.btnn.Text = "N"
        '
        'btnz
        '
        Me.btnz.Enabled = False
        Me.btnz.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnz.ForeColor = System.Drawing.Color.Firebrick
        Me.btnz.Location = New System.Drawing.Point(576, 416)
        Me.btnz.Name = "btnz"
        Me.btnz.Size = New System.Drawing.Size(32, 32)
        Me.btnz.TabIndex = 29
        Me.btnz.Text = "Z"
        '
        'lblwin
        '
        Me.lblwin.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblwin.ForeColor = System.Drawing.Color.Firebrick
        Me.lblwin.Location = New System.Drawing.Point(192, 464)
        Me.lblwin.Name = "lblwin"
        Me.lblwin.Size = New System.Drawing.Size(144, 40)
        Me.lblwin.TabIndex = 30
        Me.lblwin.Text = "Win:"
        '
        'lblloss
        '
        Me.lblloss.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblloss.ForeColor = System.Drawing.Color.Firebrick
        Me.lblloss.Location = New System.Drawing.Point(408, 464)
        Me.lblloss.Name = "lblloss"
        Me.lblloss.Size = New System.Drawing.Size(144, 40)
        Me.lblloss.TabIndex = 31
        Me.lblloss.Text = "Loss:"
        '
        'lbllefty
        '
        Me.lbllefty.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbllefty.ForeColor = System.Drawing.Color.Firebrick
        Me.lbllefty.Location = New System.Drawing.Point(288, 8)
        Me.lbllefty.Name = "lbllefty"
        Me.lbllefty.Size = New System.Drawing.Size(144, 40)
        Me.lbllefty.TabIndex = 32
        Me.lbllefty.Text = "Left:"
        '
        'lblwin1
        '
        Me.lblwin1.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblwin1.ForeColor = System.Drawing.Color.Firebrick
        Me.lblwin1.Location = New System.Drawing.Point(328, 464)
        Me.lblwin1.Name = "lblwin1"
        Me.lblwin1.Size = New System.Drawing.Size(64, 40)
        Me.lblwin1.TabIndex = 33
        '
        'lbllefty1
        '
        Me.lbllefty1.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbllefty1.ForeColor = System.Drawing.Color.Firebrick
        Me.lbllefty1.Location = New System.Drawing.Point(432, 8)
        Me.lbllefty1.Name = "lbllefty1"
        Me.lbllefty1.Size = New System.Drawing.Size(64, 40)
        Me.lbllefty1.TabIndex = 34
        '
        'lblloss1
        '
        Me.lblloss1.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblloss1.ForeColor = System.Drawing.Color.Firebrick
        Me.lblloss1.Location = New System.Drawing.Point(544, 464)
        Me.lblloss1.Name = "lblloss1"
        Me.lblloss1.Size = New System.Drawing.Size(64, 40)
        Me.lblloss1.TabIndex = 35
        '
        'lblguesses1
        '
        Me.lblguesses1.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblguesses1.ForeColor = System.Drawing.Color.Firebrick
        Me.lblguesses1.Location = New System.Drawing.Point(152, 8)
        Me.lblguesses1.Name = "lblguesses1"
        Me.lblguesses1.Size = New System.Drawing.Size(64, 40)
        Me.lblguesses1.TabIndex = 37
        '
        'lblguesses
        '
        Me.lblguesses.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblguesses.ForeColor = System.Drawing.Color.Firebrick
        Me.lblguesses.Location = New System.Drawing.Point(8, 8)
        Me.lblguesses.Name = "lblguesses"
        Me.lblguesses.Size = New System.Drawing.Size(144, 40)
        Me.lblguesses.TabIndex = 36
        Me.lblguesses.Text = "Guesses:"
        '
        'lblmisses1
        '
        Me.lblmisses1.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblmisses1.ForeColor = System.Drawing.Color.Firebrick
        Me.lblmisses1.Location = New System.Drawing.Point(712, 8)
        Me.lblmisses1.Name = "lblmisses1"
        Me.lblmisses1.Size = New System.Drawing.Size(64, 40)
        Me.lblmisses1.TabIndex = 39
        '
        'lblmisses
        '
        Me.lblmisses.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblmisses.ForeColor = System.Drawing.Color.Firebrick
        Me.lblmisses.Location = New System.Drawing.Point(568, 8)
        Me.lblmisses.Name = "lblmisses"
        Me.lblmisses.Size = New System.Drawing.Size(144, 40)
        Me.lblmisses.TabIndex = 38
        Me.lblmisses.Text = "Misses:"
        '
        'picturebox
        '
        Me.picturebox.Image = CType(resources.GetObject("picturebox.Image"), System.Drawing.Bitmap)
        Me.picturebox.Location = New System.Drawing.Point(216, 56)
        Me.picturebox.Name = "picturebox"
        Me.picturebox.Size = New System.Drawing.Size(336, 264)
        Me.picturebox.TabIndex = 40
        Me.picturebox.TabStop = False
        '
        'form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.Color.Black
        Me.ClientSize = New System.Drawing.Size(784, 518)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.picturebox, Me.lblmisses1, Me.lblmisses, Me.lblguesses1, Me.lblguesses, Me.lblloss1, Me.lbllefty1, Me.lblwin1, Me.lbllefty, Me.lblloss, Me.lblwin, Me.btnz, Me.btnn, Me.btno, Me.btnp, Me.btnq, Me.btnr, Me.btns, Me.btnt, Me.btnu, Me.btnv, Me.btnw, Me.btnx, Me.btny, Me.btnb, Me.btnc, Me.btnd, Me.btne, Me.btnf, Me.btng, Me.btnh, Me.btni, Me.btnj, Me.btnk, Me.btnl, Me.btnm, Me.btna, Me.btnexit, Me.lbloutput, Me.btnstart})
        Me.Name = "form1"
        Me.Text = "Hangman Game"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Dim word As String
    Dim counter As Integer
    Dim length As Decimal
    Dim display As String




    'play button
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnstart.Click
        word = GetNewWord("mm.txt") 'gets word from txt file
        enable() 'when play is clicked all letters are enabled
        lbloutput.Text = underscore(word.Length, "") 'displays underscores
        lblmisses1.Text = "0" 'resets
        lbllefty1.Text = "5" 'resets
        lblguesses1.Text = "0" 'resets
        If lbloutput.Text = "" Then 'message when u run out of words
            MessageBox.Show("Sorry... you dont get to kill Wile E. Coyote again. You ran out of words...")
        End If
        picturebox.Image = Image.FromFile("1.jpg") 'resets first image
    End Sub


    'underscore function
    Private Function underscore(ByVal wordlength As Integer, ByVal undscore As String) As String
        For wordlength = 0 To wordlength - 1
            undscore += "_ "
        Next

        Return undscore
    End Function

    'main function
    Private Function check(ByVal letter As String, ByVal place As Integer, ByVal testletter As String) As String
        Dim word1 As String
        Dim total As String
        Dim one As String
        Dim two As String
        If letter.ToUpper = testletter.ToUpper Then
            If place = 0 Then
                word1 = lbloutput.Text
                one = word1.Substring(place * 2 + 1)
                total = letter + one
                Return total
            End If
            If place > 0 Then
                word1 = lbloutput.Text
                two = word1.Substring(0, place * 2)
                one = word1.Substring(place * 2 + 1)
                total = two + letter + one
                Return total
            End If
        Else
            Return lbloutput.Text
        End If
    End Function



    'sub that is sent to main function to display word
    Private Sub ihatesubs(ByVal letter As String)
        Dim intcounter As Integer
        For intcounter = 0 To word.Length - 1 Step 1
            lbloutput.Text = check(letter, intcounter, word.Substring(intcounter, 1))
        Next


    End Sub

    'function to determine how many letters left to click
    Private Function lefty()
        lbllefty1.Text = 5 - Val(lblmisses1.Text)
    End Function

    'function to count the number of letters clicked
    Private Sub guesses()
        lblguesses1.Text = Val(lblguesses1.Text) + 1
    End Sub

    'functino to determine number of wrong letters clicked, also to display images when wrong
    Private Sub misses(ByVal letter As String)
        If word.IndexOf(letter) = -1 Then
            lblmisses1.Text = Val(lblmisses1.Text) + 1
        End If
        If lblmisses1.Text = "1" Then
            picturebox.Image = Image.FromFile("cayote1.gif")
        End If
        If lblmisses1.Text = "2" Then
            picturebox.Image = Image.FromFile("cayote2.gif")
        End If
        If lblmisses1.Text = "3" Then
            picturebox.Image = Image.FromFile("cayote3.gif")
        End If
        If lblmisses1.Text = "4" Then
            picturebox.Image = Image.FromFile("uho.jpg")
        End If
        If lblmisses1.Text = "5" Then
            picturebox.Image = Image.FromFile("6.jpg")
        End If
    End Sub
    Private Sub lose()
        If lblmisses1.Text = "5" Then
            lblloss1.Text = Val(lblloss1.Text) + 1
            lblmisses1.Text = "0"
            lbllefty1.Text = "5"
            lblguesses1.Text = "0"
            disable()
            MessageBox.Show("YAY!!!! YOU GOT TO KILL HIM!!!! :) ... The word was " & word)

        End If
    End Sub
    Private Sub win()
        If lbloutput.Text.IndexOf("_") = -1 Then
            lblwin1.Text = Val(lblwin1.Text) + 1
            disable()
            lblmisses1.Text = "0"
            lbllefty1.Text = "5"
            lblguesses1.Text = "0"
            MessageBox.Show("Awww... you didn't get to kill him, thats ok, you can try again!")
        End If
    End Sub





    Private Function enable()
        btna.Enabled = True
        btnb.Enabled = True
        btnc.Enabled = True
        btnd.Enabled = True
        btne.Enabled = True
        btnf.Enabled = True
        btng.Enabled = True
        btnh.Enabled = True
        btni.Enabled = True
        btnj.Enabled = True
        btnk.Enabled = True
        btnl.Enabled = True
        btnm.Enabled = True
        btnn.Enabled = True
        btno.Enabled = True
        btnp.Enabled = True
        btnq.Enabled = True
        btnr.Enabled = True
        btns.Enabled = True
        btnt.Enabled = True
        btnu.Enabled = True
        btnv.Enabled = True
        btnw.Enabled = True
        btnx.Enabled = True
        btny.Enabled = True
        btnz.Enabled = True
    End Function

    Private Function disable()
        btna.Enabled = False
        btnb.Enabled = False
        btnc.Enabled = False
        btnd.Enabled = False
        btne.Enabled = False
        btnf.Enabled = False
        btng.Enabled = False
        btnh.Enabled = False
        btni.Enabled = False
        btnj.Enabled = False
        btnk.Enabled = False
        btnl.Enabled = False
        btnm.Enabled = False
        btnn.Enabled = False
        btno.Enabled = False
        btnp.Enabled = False
        btnq.Enabled = False
        btnr.Enabled = False
        btns.Enabled = False
        btnt.Enabled = False
        btnu.Enabled = False
        btnv.Enabled = False
        btnw.Enabled = False
        btnx.Enabled = False
        btny.Enabled = False
        btnz.Enabled = False
    End Function









    '----------------------------------------------------LETTER CLICK EVENTS--------------------------------------------------------------------
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btna.Click
        btna.Enabled = False
        ihatesubs("a")
        misses("a")
        lefty()
        guesses()
        lose()
        win()
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnb.Click
        btnb.Enabled = False
        ihatesubs("b")
        misses("b")
        lefty()
        guesses()
        lose()
        win()
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnc.Click
        btnc.Enabled = False
        ihatesubs("c")
        misses("c")
        lefty()
        guesses()
        lose()
        win()
    End Sub
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnd.Click
        btnd.Enabled = False
        ihatesubs("d")
        misses("d")
        lefty()
        guesses()
        lose()
        win()
    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btne.Click
        ihatesubs("e")
        btne.Enabled = False
        misses("e")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnf.Click
        ihatesubs("f")
        btnf.Enabled = False
        misses("f")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btng.Click
        ihatesubs("g")
        btng.Enabled = False
        misses("g")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnh.Click
        ihatesubs("h")
        btnh.Enabled = False
        misses("h")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btni.Click
        ihatesubs("i")
        btni.Enabled = False
        misses("i")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnj.Click
        ihatesubs("j")
        btnj.Enabled = False
        misses("j")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnk.Click
        ihatesubs("k")
        btnk.Enabled = False
        misses("k")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnl.Click
        ihatesubs("l")
        btnl.Enabled = False
        misses("l")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnm.Click
        ihatesubs("m")
        btnm.Enabled = False
        misses("m")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnn.Click
        ihatesubs("n")
        btnn.Enabled = False
        misses("n")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btno.Click
        ihatesubs("o")
        btno.Enabled = False
        misses("o")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnp.Click
        ihatesubs("p")
        btnp.Enabled = False
        misses("p")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnq.Click
        ihatesubs("q")
        btnq.Enabled = False
        misses("q")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnr.Click
        ihatesubs("r")
        btnr.Enabled = False
        misses("r")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btns.Click
        ihatesubs("s")
        btns.Enabled = False
        misses("s")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnt.Click
        ihatesubs("t")
        btnt.Enabled = False
        misses("t")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnu.Click
        ihatesubs("u")
        btnu.Enabled = False
        misses("u")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnv.Click
        ihatesubs("v")
        btnv.Enabled = False
        misses("v")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnw.Click
        ihatesubs("w")
        btnw.Enabled = False
        misses("w")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnx.Click
        ihatesubs("x")
        btnx.Enabled = False
        misses("x")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btny.Click
        ihatesubs("y")
        btny.Enabled = False
        misses("y")
        win()
        lefty()
        guesses()
        lose()
    End Sub
    Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnz.Click
        ihatesubs("z")
        btnz.Enabled = False
        misses("z")
        win()
        lefty()
        guesses()
        lose()
    End Sub

    '--------------------------------------------------ABCDEFGHIJKLMNOPQRSTUVQXYZ-------------------------------------------------------------------


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
        Me.Close()
    End Sub



    Private Sub lblguesses1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblguesses1.Click

    End Sub
End Class

ok hangman all worked perfectly... then suddenly this erro came up!!!

SOMEBODY HELP ME PLEASE THIS IS DUE 2MORROW!!!

in your function for the misses, its a sub instead of a function. i have no idea if that is causing the problem, just noticed it and decided to point it out. ive got clark to..... and im just now finishing the project and its thursday night haha. good luck.... this program is frustrating :(

this program is frustrating

Hangman in VB????? if you can do the following:

1) Use an array
2) Use strings

it'll be all over in minutes! or maybe thats just me... :) If you havent been taught arrays (earlier posts) then ill agree it becomes harder but with a pen and paper you should be able design a program to solve it fairly quickly. How did it go anyway as ive been away for a while and havent seen this post in time to help before the deadline :(

If U can send me the Hangman Project as a ZIP File den can tel my dad to look at it. cause he is a teacher . i m sure he will be able to help you with

ust like a few others, i was assigned a Hangman project for VB.NET!!!

Yea so this is wat we have to do

-----read a word from a text box - DONE

-----when play is clicked, the word is read and the number of letters is replaced with an underscore (_ ) - DONE

check if the letter clicked is in the word -NOT DONE HAS TO BE A FUNCTION! - so that all u have to do is call the function for each letter

display the letter if it is found- NOT DONE also a function

each miss should have a part of the man be built - NOT DONE, should be a function

please somebody help me, i have till sunday to finish this, i've been trying and trying, and i'm still lost....


here is my code so far... please help me, i'm seriosly desperate, its realy messed up, dont know wats wrong nor how to fix it

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents btna As System.Windows.Forms.Button
    Friend WithEvents btnm As System.Windows.Forms.Button
    Friend WithEvents btnl As System.Windows.Forms.Button
    Friend WithEvents btnk As System.Windows.Forms.Button
    Friend WithEvents btnj As System.Windows.Forms.Button
    Friend WithEvents btni As System.Windows.Forms.Button
    Friend WithEvents btng As System.Windows.Forms.Button
    Friend WithEvents btnf As System.Windows.Forms.Button
    Friend WithEvents btne As System.Windows.Forms.Button
    Friend WithEvents btnd As System.Windows.Forms.Button
    Friend WithEvents btnc As System.Windows.Forms.Button
    Friend WithEvents btnb As System.Windows.Forms.Button
    Friend WithEvents btnu As System.Windows.Forms.Button
    Friend WithEvents btnt As System.Windows.Forms.Button
    Friend WithEvents btns As System.Windows.Forms.Button
    Friend WithEvents btnr As System.Windows.Forms.Button
    Friend WithEvents btnq As System.Windows.Forms.Button
    Friend WithEvents btnp As System.Windows.Forms.Button
    Friend WithEvents btno As System.Windows.Forms.Button
    Friend WithEvents btnn As System.Windows.Forms.Button
    Friend WithEvents btny As System.Windows.Forms.Button
    Friend WithEvents btnx As System.Windows.Forms.Button
    Friend WithEvents btnw As System.Windows.Forms.Button
    Friend WithEvents btnv As System.Windows.Forms.Button
    Friend WithEvents btnz As System.Windows.Forms.Button
    Friend WithEvents btnh As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Button2 = New System.Windows.Forms.Button()
        Me.btna = New System.Windows.Forms.Button()
        Me.btnm = New System.Windows.Forms.Button()
        Me.btnl = New System.Windows.Forms.Button()
        Me.btnk = New System.Windows.Forms.Button()
        Me.btnj = New System.Windows.Forms.Button()
        Me.btni = New System.Windows.Forms.Button()
        Me.btnh = New System.Windows.Forms.Button()
        Me.btng = New System.Windows.Forms.Button()
        Me.btnf = New System.Windows.Forms.Button()
        Me.btne = New System.Windows.Forms.Button()
        Me.btnd = New System.Windows.Forms.Button()
        Me.btnc = New System.Windows.Forms.Button()
        Me.btnb = New System.Windows.Forms.Button()
        Me.btny = New System.Windows.Forms.Button()
        Me.btnx = New System.Windows.Forms.Button()
        Me.btnw = New System.Windows.Forms.Button()
        Me.btnv = New System.Windows.Forms.Button()
        Me.btnu = New System.Windows.Forms.Button()
        Me.btnt = New System.Windows.Forms.Button()
        Me.btns = New System.Windows.Forms.Button()
        Me.btnr = New System.Windows.Forms.Button()
        Me.btnq = New System.Windows.Forms.Button()
        Me.btnp = New System.Windows.Forms.Button()
        Me.btno = New System.Windows.Forms.Button()
        Me.btnn = New System.Windows.Forms.Button()
        Me.btnz = New System.Windows.Forms.Button()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(8, 200)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(80, 24)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Start"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(184, 80)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(232, 40)
        Me.Label1.TabIndex = 1
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(8, 224)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(80, 24)
        Me.Button2.TabIndex = 2
        Me.Button2.Text = "Exit"
        '
        'btna
        '
        Me.btna.Location = New System.Drawing.Point(56, 256)
        Me.btna.Name = "btna"
        Me.btna.Size = New System.Drawing.Size(32, 32)
        Me.btna.TabIndex = 3
        Me.btna.Text = "A"
        '
        'btnm
        '
        Me.btnm.Location = New System.Drawing.Point(440, 256)
        Me.btnm.Name = "btnm"
        Me.btnm.Size = New System.Drawing.Size(32, 32)
        Me.btnm.TabIndex = 4
        Me.btnm.Text = "M"
        '
        'btnl
        '
        Me.btnl.Location = New System.Drawing.Point(408, 256)
        Me.btnl.Name = "btnl"
        Me.btnl.Size = New System.Drawing.Size(32, 32)
        Me.btnl.TabIndex = 5
        Me.btnl.Text = "L"
        '
        'btnk
        '
        Me.btnk.Location = New System.Drawing.Point(376, 256)
        Me.btnk.Name = "btnk"
        Me.btnk.Size = New System.Drawing.Size(32, 32)
        Me.btnk.TabIndex = 6
        Me.btnk.Text = "K"
        '
        'btnj
        '
        Me.btnj.Location = New System.Drawing.Point(344, 256)
        Me.btnj.Name = "btnj"
        Me.btnj.Size = New System.Drawing.Size(32, 32)
        Me.btnj.TabIndex = 7
        Me.btnj.Text = "J"
        '
        'btni
        '
        Me.btni.Location = New System.Drawing.Point(312, 256)
        Me.btni.Name = "btni"
        Me.btni.Size = New System.Drawing.Size(32, 32)
        Me.btni.TabIndex = 8
        Me.btni.Text = "I"
        '
        'btnh
        '
        Me.btnh.Location = New System.Drawing.Point(280, 256)
        Me.btnh.Name = "btnh"
        Me.btnh.Size = New System.Drawing.Size(32, 32)
        Me.btnh.TabIndex = 9
        Me.btnh.Text = "H"
        '
        'btng
        '
        Me.btng.Location = New System.Drawing.Point(248, 256)
        Me.btng.Name = "btng"
        Me.btng.Size = New System.Drawing.Size(32, 32)
        Me.btng.TabIndex = 10
        Me.btng.Text = "G"
        '
        'btnf
        '
        Me.btnf.Location = New System.Drawing.Point(216, 256)
        Me.btnf.Name = "btnf"
        Me.btnf.Size = New System.Drawing.Size(32, 32)
        Me.btnf.TabIndex = 11
        Me.btnf.Text = "F"
        '
        'btne
        '
        Me.btne.Location = New System.Drawing.Point(184, 256)
        Me.btne.Name = "btne"
        Me.btne.Size = New System.Drawing.Size(32, 32)
        Me.btne.TabIndex = 12
        Me.btne.Text = "E"
        '
        'btnd
        '
        Me.btnd.Location = New System.Drawing.Point(152, 256)
        Me.btnd.Name = "btnd"
        Me.btnd.Size = New System.Drawing.Size(32, 32)
        Me.btnd.TabIndex = 13
        Me.btnd.Text = "D"
        '
        'btnc
        '
        Me.btnc.Location = New System.Drawing.Point(120, 256)
        Me.btnc.Name = "btnc"
        Me.btnc.Size = New System.Drawing.Size(32, 32)
        Me.btnc.TabIndex = 14
        Me.btnc.Text = "C"
        '
        'btnb
        '
        Me.btnb.Location = New System.Drawing.Point(88, 256)
        Me.btnb.Name = "btnb"
        Me.btnb.Size = New System.Drawing.Size(32, 32)
        Me.btnb.TabIndex = 15
        Me.btnb.Text = "B"
        '
        'btny
        '
        Me.btny.Location = New System.Drawing.Point(408, 288)
        Me.btny.Name = "btny"
        Me.btny.Size = New System.Drawing.Size(32, 32)
        Me.btny.TabIndex = 16
        Me.btny.Text = "Y"
        '
        'btnx
        '
        Me.btnx.Location = New System.Drawing.Point(376, 288)
        Me.btnx.Name = "btnx"
        Me.btnx.Size = New System.Drawing.Size(32, 32)
        Me.btnx.TabIndex = 17
        Me.btnx.Text = "X"
        '
        'btnw
        '
        Me.btnw.Location = New System.Drawing.Point(344, 288)
        Me.btnw.Name = "btnw"
        Me.btnw.Size = New System.Drawing.Size(32, 32)
        Me.btnw.TabIndex = 18
        Me.btnw.Text = "W"
        '
        'btnv
        '
        Me.btnv.Location = New System.Drawing.Point(312, 288)
        Me.btnv.Name = "btnv"
        Me.btnv.Size = New System.Drawing.Size(32, 32)
        Me.btnv.TabIndex = 19
        Me.btnv.Text = "V"
        '
        'btnu
        '
        Me.btnu.Location = New System.Drawing.Point(280, 288)
        Me.btnu.Name = "btnu"
        Me.btnu.Size = New System.Drawing.Size(32, 32)
        Me.btnu.TabIndex = 20
        Me.btnu.Text = "U"
        '
        'btnt
        '
        Me.btnt.Location = New System.Drawing.Point(248, 288)
        Me.btnt.Name = "btnt"
        Me.btnt.Size = New System.Drawing.Size(32, 32)
        Me.btnt.TabIndex = 21
        Me.btnt.Text = "T"
        '
        'btns
        '
        Me.btns.Location = New System.Drawing.Point(216, 288)
        Me.btns.Name = "btns"
        Me.btns.Size = New System.Drawing.Size(32, 32)
        Me.btns.TabIndex = 22
        Me.btns.Text = "S"
        '
        'btnr
        '
        Me.btnr.Location = New System.Drawing.Point(184, 288)
        Me.btnr.Name = "btnr"
        Me.btnr.Size = New System.Drawing.Size(32, 32)
        Me.btnr.TabIndex = 23
        Me.btnr.Text = "R"
        '
        'btnq
        '
        Me.btnq.Location = New System.Drawing.Point(152, 288)
        Me.btnq.Name = "btnq"
        Me.btnq.Size = New System.Drawing.Size(32, 32)
        Me.btnq.TabIndex = 24
        Me.btnq.Text = "Q"
        '
        'btnp
        '
        Me.btnp.Location = New System.Drawing.Point(120, 288)
        Me.btnp.Name = "btnp"
        Me.btnp.Size = New System.Drawing.Size(32, 32)
        Me.btnp.TabIndex = 25
        Me.btnp.Text = "P"
        '
        'btno
        '
        Me.btno.Location = New System.Drawing.Point(88, 288)
        Me.btno.Name = "btno"
        Me.btno.Size = New System.Drawing.Size(32, 32)
        Me.btno.TabIndex = 26
        Me.btno.Text = "O"
        '
        'btnn
        '
        Me.btnn.Location = New System.Drawing.Point(56, 288)
        Me.btnn.Name = "btnn"
        Me.btnn.Size = New System.Drawing.Size(32, 32)
        Me.btnn.TabIndex = 27
        Me.btnn.Text = "N"
        '
        'btnz
        '
        Me.btnz.Location = New System.Drawing.Point(440, 288)
        Me.btnz.Name = "btnz"
        Me.btnz.Size = New System.Drawing.Size(32, 32)
        Me.btnz.TabIndex = 29
        Me.btnz.Text = "Z"
        '
        'Label2
        '
        Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.Location = New System.Drawing.Point(0, 48)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(144, 40)
        Me.Label2.TabIndex = 30
        Me.Label2.Text = "Win:"
        '
        'Label3
        '
        Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label3.Location = New System.Drawing.Point(0, 88)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(144, 40)
        Me.Label3.TabIndex = 31
        Me.Label3.Text = "Loss:"
        '
        'Label4
        '
        Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label4.Location = New System.Drawing.Point(0, 128)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(144, 40)
        Me.Label4.TabIndex = 32
        Me.Label4.Text = "Left:"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(512, 358)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label4, Me.Label3, Me.Label2, Me.btnz, Me.btnn, Me.btno, Me.btnp, Me.btnq, Me.btnr, Me.btns, Me.btnt, Me.btnu, Me.btnv, Me.btnw, Me.btnx, Me.btny, Me.btnb, Me.btnc, Me.btnd, Me.btne, Me.btnf, Me.btng, Me.btnh, Me.btni, Me.btnj, Me.btnk, Me.btnl, Me.btnm, Me.btna, Me.Button2, Me.Label1, Me.Button1})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim word As String
    Dim counter As Integer
    Dim length As Decimal
    Dim display As String
    Dim place As Integer










    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        word = GetNewWord("mm.txt")
        enable()
        Label1.Text = underscore(word.Length, "")

    End Sub

    Private Function underscore(ByVal wordlength As Integer, ByVal undscore As String) As String

        For wordlength = 0 To wordlength - 1
            undscore += "_ "
        Next

        Return undscore


    End Function


    Private Function check(ByVal letter As String, ByVal word1 As String, ByVal total As String, ByVal one As String, ByVal two As String)

        place = word.IndexOf(letter)
        If place = 0 Then
            word1 = Label1.Text
            one = word1.Substring(place)

            total = letter + " " + one
            Return total

        End If


        If place > 0 Then
            word1 = Label1.Text
            two = word1.Substring(0, place)
            one = word1.Substring(place)
            total = one + " " + letter + " " + two
            Return total
            Return Label1.Text - 1

        End If



    End Function



    Private Function enable()
        btna.Enabled = True
        btnb.Enabled = True
        btnc.Enabled = True
        btnd.Enabled = True
        btne.Enabled = True
        btnf.Enabled = True
        btng.Enabled = True
        btnh.Enabled = True
        btni.Enabled = True
        btnj.Enabled = True
        btnk.Enabled = True
        btnl.Enabled = True
        btnm.Enabled = True
        btnn.Enabled = True
        btno.Enabled = True
        btnp.Enabled = True
        btnq.Enabled = True
        btnr.Enabled = True
        btns.Enabled = True
        btnt.Enabled = True
        btnu.Enabled = True
        btnv.Enabled = True
        btnw.Enabled = True
        btnx.Enabled = True
        btny.Enabled = True
        btnz.Enabled = True
    End Function










    '----------------------------------------------------LETTER CLICK EVENTS--------------------------------------------------------------------
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btna.Click
        btna.Enabled = False
        Label1.Text = check("a", "", "", "", "")
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnb.Click
        btnb.Enabled = False
        Label1.Text = check("b", "", "", "", "")
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnc.Click
        btnc.Enabled = False
        Label1.Text = check("b", "", "", "", "")
    End Sub
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnd.Click
        btnd.Enabled = False
        Label1.Text = check("d", "", "", "", "")
    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btne.Click
        Label1.Text = check("e", "", "", "", "")
        btne.Enabled = False
    End Sub
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnf.Click
        check("f", "", "", "", "")
        btnf.Enabled = False
    End Sub
    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btng.Click
        Label1.Text = check("g", "", "", "", "")
        btng.Enabled = False
    End Sub
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnh.Click
        Label1.Text = check("h", "", "", "", "")
        btnh.Enabled = False
    End Sub
    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btni.Click
        Label1.Text = check("i", "", "", "", "")
        btni.Enabled = False
    End Sub
    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnj.Click
        Label1.Text = check("j", "", "", "", "")
        btnj.Enabled = False
    End Sub
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnk.Click
        Label1.Text = check("k", "", "", "", "")
        btnk.Enabled = False
    End Sub
    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnl.Click
        Label1.Text = check("l", "", "", "", "")
        btnl.Enabled = False
    End Sub
    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnm.Click
        Label1.Text = check("m", "", "", "", "")
        btnm.Enabled = False
    End Sub
    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnn.Click
        Label1.Text = check("n", "", "", "", "")
        btnn.Enabled = False
    End Sub
    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btno.Click
        Label1.Text = check("o", "", "", "", "")
        btno.Enabled = False
    End Sub
    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnp.Click
        Label1.Text = check("p", "", "", "", "")
        btnp.Enabled = False
    End Sub
    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnq.Click
        Label1.Text = check("q", "", "", "", "")
        btnq.Enabled = False
    End Sub
    Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnr.Click
        Label1.Text = check("r", "", "", "", "")
        btnr.Enabled = False
    End Sub
    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btns.Click
        Label1.Text = check("s", "", "", "", "")
        btns.Enabled = False
    End Sub
    Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnt.Click
        Label1.Text = check("t", "", "", "", "")
        btnt.Enabled = False
    End Sub
    Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnu.Click
        Label1.Text = check("u", "", "", "", "")
        btnu.Enabled = False
    End Sub
    Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnv.Click
        Label1.Text = check("v", "", "", "", "")
        btnv.Enabled = False
    End Sub
    Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnw.Click
        Label1.Text = check("w", "", "", "", "")
        btnw.Enabled = False
    End Sub
    Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnx.Click
        Label1.Text = check("x", "", "", "", "")
        btnx.Enabled = False
    End Sub
    Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btny.Click
        Label1.Text = check("y", "", "", "", "")
        btny.Enabled = False
    End Sub
    Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnz.Click
        Label1.Text = check("z", "", "", "", "")
        btnz.Enabled = False
    End Sub

    '--------------------------------------------------ABCDEFGHIJKLMNOPQRSTUVQXYZ-------------------------------------------------------------------


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
End Class

Hey Man

looks like u no most of the things in Vb.Net

so can u please help me out in VB.Net Assignment.

i have done my Hangman Game in VB6 but i am not bale to do de hangman game in VB.Net .

so if u can can u please give me de whole program code.

it will be very nice if you can

Thank you

Ive programmed in VB for a LONG time but the vb.net code I see is a bit more complex, even some c/c++ inspiration in it! However i had a look at what you are trying to do. When you say the number of letters in the word do you mean individual letters or multiple letters for example

the word is "missed" and the user has got mi___d

would you like to print 2 (e and s missing)
or would you like to get 3 (e and two esses missing)

I assumed you are after recognising the individual letters (the first option). I would still use a boolean array for each letter (26). When you get the word from the file you need to have a temp array of 26 booleans, then go through each letter in the word, setting the appropriate index in the temp array to true (therefore multiple letters wont get counted twice as they have the same index), then going through the ARRAY and counting the number of 'true' states. This gives you the number of different letters in the word. When the user makes a correct guess, decrement this number.

Example:

the word is excited

our array is full of boolean falses (dim letters(25) as boolean or whatever)
we go through the word and get e, so we set letters(4) to true
we go through the word and get x, so we set letters(23) to true
we go through the word and get c, so we set letters(2) to true
we go through the word and get i, so we set letters(8) to true
we go through the word and get t, so we set letters(19) to true
we go through the word and get e, so we set letters(4) to true 'the duplicate e doesnt matter
we go through the word and get d, so we set letters(3) to true

so the array looks a bit like this

a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0

we have 6 true states so there are 6 different letters in the word 'excited', when we get a correct guess we take one from this number so after the user has got:

ex__te_ we have 3 letters left (c, d, and i)

i understand why you would want to use a boolean array, but how do you fill that array with the contents of the word ?

This article has been dead for over six months. Start a new discussion instead.