Public Class frmTable
  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 Label1 As System.Windows.Forms.Label
  Friend WithEvents txtNumber As System.Windows.Forms.TextBox
  Friend WithEvents txtResult As System.Windows.Forms.TextBox
  Friend WithEvents btnCalc As System.Windows.Forms.Button
  Friend WithEvents btnExit As System.Windows.Forms.Button
  Friend WithEvents lblResult As System.Windows.Forms.Label
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.Label1 = New System.Windows.Forms.Label()
    Me.txtNumber = New System.Windows.Forms.TextBox()
    Me.txtResult = New System.Windows.Forms.TextBox()
    Me.lblResult = New System.Windows.Forms.Label()
    Me.btnCalc = New System.Windows.Forms.Button()
    Me.btnExit = New System.Windows.Forms.Button()
    Me.SuspendLayout()
    '
    'Label1
    '
    Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
    Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.Label1.Location = New System.Drawing.Point(8, 16)
    Me.Label1.Name = "Label1"
    Me.Label1.Size = New System.Drawing.Size(200, 20)
    Me.Label1.TabIndex = 0
    Me.Label1.Text = "Enter a number (0 to 5):"
    Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
    '
    'txtNumber
    '
    Me.txtNumber.Location = New System.Drawing.Point(208, 16)
    Me.txtNumber.Name = "txtNumber"
    Me.txtNumber.Size = New System.Drawing.Size(80, 20)
    Me.txtNumber.TabIndex = 1
    Me.txtNumber.Text = ""
    '
    'txtResult
    '
    Me.txtResult.Location = New System.Drawing.Point(208, 40)
    Me.txtResult.Name = "txtResult"
    Me.txtResult.Size = New System.Drawing.Size(80, 20)
    Me.txtResult.TabIndex = 3
    Me.txtResult.Text = ""
    Me.txtResult.Visible = False
    '
    'lblResult
    '
    Me.lblResult.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
    Me.lblResult.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.lblResult.Location = New System.Drawing.Point(8, 40)
    Me.lblResult.Name = "lblResult"
    Me.lblResult.Size = New System.Drawing.Size(200, 20)
    Me.lblResult.TabIndex = 2
    Me.lblResult.Text = "The square is:"
    Me.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleRight
    Me.lblResult.Visible = False
    '
    'btnCalc
    '
    Me.btnCalc.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.btnCalc.Location = New System.Drawing.Point(16, 80)
    Me.btnCalc.Name = "btnCalc"
    Me.btnCalc.Size = New System.Drawing.Size(96, 24)
    Me.btnCalc.TabIndex = 4
    Me.btnCalc.Text = "&Calculate"
    '
    '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.Location = New System.Drawing.Point(192, 80)
    Me.btnExit.Name = "btnExit"
    Me.btnExit.Size = New System.Drawing.Size(96, 24)
    Me.btnExit.TabIndex = 5
    Me.btnExit.Text = "E&xit"
    '
    'frmTable
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(312, 109)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnExit, Me.btnCalc, Me.txtResult, Me.lblResult, Me.txtNumber, Me.Label1})
    Me.Name = "frmTable"
    Me.Text = "Squares Program"
    Me.ResumeLayout(False)

  End Sub

#End Region

  Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
    Dim SqaresTable(5, 1) As Integer
    Dim MyArray(,) As Integer

    '   ReDim MyArray(10, 10)

    ReDim MyArray(3, 5)

    SqaresTable(0, 0) = 0
    SqaresTable(0, 1) = 0
    SqaresTable(1, 0) = 1
    SqaresTable(1, 1) = 1
    SqaresTable(2, 0) = 2
    SqaresTable(2, 1) = 4
    SqaresTable(3, 0) = 3
    SqaresTable(3, 1) = 9
    SqaresTable(4, 0) = 4
    SqaresTable(4, 1) = 16
    SqaresTable(5, 0) = 5
    SqaresTable(5, 1) = 25

    txtResult.Text = CStr(SqaresTable(CInt(txtNumber.Text), 1))

    lblResult.Visible = True
    txtResult.Visible = True

  End Sub

  Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
    Me.Dispose()
  End Sub
End Class
