Big Problem, Gdi+ Error

weazel

New member
Joined
Jan 4, 2005
Messages
2
Programming Experience
Beginner
please.. help me.. 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+.


VB.NET:
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
 
Last edited by a moderator:
Back
Top