Efficient?

ARC

Well-known member
Joined
Sep 9, 2006
Messages
63
Location
Minnesota
Programming Experience
Beginner
Hi, so my biggest problem right now is being sloppy with my code. If someone could skim through this quick and see if it's efficiently arranged; or maybe make some suggestions about how to streamline the processes better -- I would be greatly appreciated.

VB.NET:
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE][SIZE=2] Form1[/SIZE]
 
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] Drow [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] Dcolumn [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] Prow [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] Pcolumn [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] Erow [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] Ecolumn [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] UpperCase [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] Gold [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] CheckText()[/SIZE]
[SIZE=2]UpperCase = inputtext.Text.ToUpper[/SIZE]
[SIZE=2][COLOR=#008000][/COLOR][/SIZE] 
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'These are all of the accepted commands[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'the user can type in to preform a[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'function, such as move, or exit[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'program[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] UpperCase[/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2][COLOR=#800000]"/EXIT"[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]    Me[/COLOR][/SIZE][SIZE=2].Close()[/SIZE]
 
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2][COLOR=#800000]"/N"[/COLOR][/SIZE]
[SIZE=2]    movement()[/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2][COLOR=#800000]"/S"[/COLOR][/SIZE]
[SIZE=2]    movement()[/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2][COLOR=#800000]"/W"[/COLOR][/SIZE]
[SIZE=2]    movement()[/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2][COLOR=#800000]"/E"[/COLOR][/SIZE]
[SIZE=2]    movement()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[COLOR=#0000ff][/COLOR] 
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] LabelRefresh()[/SIZE]
[SIZE=2][COLOR=#008000][/COLOR][/SIZE] 
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'Refreshes all of the labeles when[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'called[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].roomlabel.Text = [/SIZE][SIZE=2][COLOR=#800000]"Room: "[/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#0000ff]CStr[/COLOR][/SIZE][SIZE=2](Prow) + [/SIZE][SIZE=2][COLOR=#800000]","[/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#0000ff]CStr[/COLOR][/SIZE][SIZE=2](Pcolumn)[/SIZE]
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].goldlabel.Text = [/SIZE][SIZE=2][COLOR=#800000]"Gold: "[/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#0000ff]CStr[/COLOR][/SIZE][SIZE=2](Gold)[/SIZE]
[SIZE=2]Form2.DLocationLabel.Text = [/SIZE][SIZE=2][COLOR=#0000ff]CStr[/COLOR][/SIZE][SIZE=2](Drow) + [/SIZE][SIZE=2][COLOR=#800000]","[/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#0000ff]CStr[/COLOR][/SIZE][SIZE=2](Dcolumn)[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Wall()[/SIZE]
[SIZE=2][COLOR=#008000][/COLOR][/SIZE] 
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'When the user selects a direction that[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'would send them out of bounds, 8x8,[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'this messege displays, and subtracts[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'one gold piece[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].outputtext.Text = [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].outputtext.Text & ControlChars.NewLine & [/SIZE][SIZE=2][COLOR=#800000]"Ouch! There's a wall there!"[/COLOR][/SIZE][SIZE=2] & ControlChars.NewLine & [/SIZE][SIZE=2][COLOR=#800000]"You dropped 1 gold piece."[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] (Gold - 1) > 0 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]    Gold = Gold - 1[/SIZE]
[SIZE=2]    LabelRefresh()[/SIZE]
[SIZE=2][COLOR=#0000ff]Else[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]    Me[/COLOR][/SIZE][SIZE=2].outputtext.Text = [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].outputtext.Text & ControlChars.NewLine & [/SIZE][SIZE=2][COLOR=#800000]"Ouch! There's a wall there!"[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] movement()[/SIZE]
[SIZE=2][COLOR=#008000][/COLOR][/SIZE] 
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'This alters the players location so[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'long as it doesnt send them out of the[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'8x8 boundries[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] UpperCase[/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2][COLOR=#800000]"/N"[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]    If[/COLOR][/SIZE][SIZE=2] (Prow - 1) > 0 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]        Prow = (Prow - 1)[/SIZE]
[SIZE=2][COLOR=#0000ff]    Else[/COLOR][/SIZE]
[SIZE=2]        Wall()[/SIZE]
[SIZE=2][COLOR=#0000ff]    End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2][COLOR=#800000]"/S"[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]    If[/COLOR][/SIZE][SIZE=2] (Prow + 1) < 9 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]        Prow = (Prow + 1)[/SIZE]
[SIZE=2][COLOR=#0000ff]    Else[/COLOR][/SIZE]
[SIZE=2]        Wall()[/SIZE]
[SIZE=2][COLOR=#0000ff]    End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2][COLOR=#800000]"/E"[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]    If[/COLOR][/SIZE][SIZE=2] (Pcolumn + 1) < 9 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]        Pcolumn = (Pcolumn + 1)[/SIZE]
[SIZE=2][COLOR=#0000ff]    Else[/COLOR][/SIZE]
[SIZE=2]        Wall()[/SIZE]
[SIZE=2][COLOR=#0000ff]    End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2][COLOR=#800000]"/W"[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]    If[/COLOR][/SIZE][SIZE=2] (Pcolumn - 1) > 0 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]        Pcolumn = (Pcolumn - 1)[/SIZE]
[SIZE=2][COLOR=#0000ff]    Else[/COLOR][/SIZE]
[SIZE=2]        Wall()[/SIZE]
[SIZE=2][COLOR=#0000ff]    End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE]
[SIZE=2][/SIZE] 
[SIZE=2]LabelRefresh()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] inputtext_KeyDown([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Windows.Forms.KeyEventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] inputtext.KeyDown[/SIZE]
[SIZE=2][COLOR=#008000][/COLOR][/SIZE] 
[SIZE=2][COLOR=#008000]'************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'When the user presses Enter, it runs[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'CheckText, and scrolls to the bottom[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'of the rich text box, then clears[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'the input text field[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] e.KeyCode = Keys.Enter [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]    Me[/COLOR][/SIZE][SIZE=2].outputtext.Text = outputtext.Text & ControlChars.NewLine & inputtext.Text[/SIZE]
[SIZE=2]    CheckText()[/SIZE]
[SIZE=2][COLOR=#0000ff]    Me[/COLOR][/SIZE][SIZE=2].outputtext.Select(outputtext.TextLength, 0)[/SIZE]
[SIZE=2][COLOR=#0000ff]    Me[/COLOR][/SIZE][SIZE=2].outputtext.ScrollToCaret()[/SIZE]
[SIZE=2][COLOR=#0000ff]    Me[/COLOR][/SIZE][SIZE=2].inputtext.Text = [/SIZE][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Form1_Load([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=2].Load[/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] RandomNumber [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Random[/SIZE]
[SIZE=2][COLOR=#008000][/COLOR][/SIZE] 
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'This sets all of the defult values for[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'when the program is first started and[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'also enables the dragon timer[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2]Gold = 100[/SIZE]
[SIZE=2]Prow = 1[/SIZE]
[SIZE=2]Pcolumn = 1[/SIZE]
[SIZE=2]Drow = RandomNumber.Next(2, 9)[/SIZE]
[SIZE=2]Dcolumn = RandomNumber.Next(2, 9)[/SIZE]
[SIZE=2]LabelRefresh()[/SIZE]
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Timer1.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Timer1_Tick([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Timer1.Tick[/SIZE]
[SIZE=2][COLOR=#008000][/COLOR][/SIZE] 
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'This picks a direction (randomly) for[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'the dragon to move -- so long as it[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'doesnt send him out of bounds[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Direction [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] RandomNumber [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Random[/SIZE]
[SIZE=2]Direction = RandomNumber.Next(1, 5)[/SIZE]
 
[SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] Direction[/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2] 1[/SIZE]
[SIZE=2][COLOR=#0000ff]    If[/COLOR][/SIZE][SIZE=2] (Drow - 1) > 0 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]        Drow = (Drow - 1)[/SIZE]
[SIZE=2][COLOR=#0000ff]    End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2] 2[/SIZE]
[SIZE=2][COLOR=#0000ff]    If[/COLOR][/SIZE][SIZE=2] (Drow + 1) < 9 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]        Drow = (Drow + 1)[/SIZE]
[SIZE=2][COLOR=#0000ff]    End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2] 3[/SIZE]
[SIZE=2][COLOR=#0000ff]    If[/COLOR][/SIZE][SIZE=2] (Dcolumn + 1) < 9 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]        Dcolumn = (Dcolumn + 1)[/SIZE]
[SIZE=2][COLOR=#0000ff]    End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]  Case[/COLOR][/SIZE][SIZE=2] 4[/SIZE]
[SIZE=2][COLOR=#0000ff]    If[/COLOR][/SIZE][SIZE=2] (Dcolumn - 1) > 0 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]        Dcolumn = (Dcolumn - 1)[/SIZE]
[SIZE=2][COLOR=#0000ff]    End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE]
[SIZE=2][/SIZE] 
[SIZE=2]LabelRefresh()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Button2_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Button2.Click[/SIZE]
[SIZE=2][COLOR=#008000][/COLOR][/SIZE] 
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'This is just a debug window for me to[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'use to make sure values are changing[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'how they are supposed to be changing[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][/SIZE] 
[SIZE=2]Form2.Show()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Button1_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Button1.Click[/SIZE]
[SIZE=2][COLOR=#008000][/COLOR][/SIZE] 
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'This preforms the same duties as the[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'ENTER key KeyDown event above[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'**************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].outputtext.Text = outputtext.Text & ControlChars.NewLine & inputtext.Text[/SIZE]
[SIZE=2]CheckText()[/SIZE]
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].outputtext.Select(outputtext.TextLength, 0)[/SIZE]
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].outputtext.ScrollToCaret()[/SIZE]
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].inputtext.Text = [/SIZE][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE]
 
Efficiency wise, there isnt much wrong with it that I would pick on. I offer the following pointers:

Your code defies Microsoft naming conventions for variables (use camelCaseForVariablesWithMultipleWords, not Sentencecaseforvariableswithmultiplewords)

You havent bothered to name any of your controls properly (Form1, Timer1, Button1, Button2)

variable += 1 can be used to add one to a variable and is considered a neater syntax than variable = variable + 1. A corollorary exists for -=

When calling a sub or a function, supply brackets:
upperCase = inputtext.Text.ToUpper()

Use Environment.NewLine to add new lines

If outputtext is a TextBox, then you might find outputText.AppendText("new text") works better than outputtext.Text = outputText.Text & "new text"
 
Back
Top