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 txtGrade1 As System.Windows.Forms.TextBox
    Friend WithEvents txtGrade2 As System.Windows.Forms.TextBox
    Friend WithEvents txtGrade3 As System.Windows.Forms.TextBox
    Friend WithEvents txtGrade4 As System.Windows.Forms.TextBox
    Friend WithEvents txtGrade5 As System.Windows.Forms.TextBox
    Friend WithEvents txtGrade6 As System.Windows.Forms.TextBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.txtGrade1 = New System.Windows.Forms.TextBox()
        Me.txtGrade2 = New System.Windows.Forms.TextBox()
        Me.txtGrade3 = New System.Windows.Forms.TextBox()
        Me.txtGrade4 = New System.Windows.Forms.TextBox()
        Me.txtGrade5 = New System.Windows.Forms.TextBox()
        Me.txtGrade6 = New System.Windows.Forms.TextBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'txtGrade1
        '
        Me.txtGrade1.Location = New System.Drawing.Point(24, 24)
        Me.txtGrade1.Name = "txtGrade1"
        Me.txtGrade1.TabIndex = 0
        Me.txtGrade1.Text = ""
        '
        'txtGrade2
        '
        Me.txtGrade2.Location = New System.Drawing.Point(24, 56)
        Me.txtGrade2.Name = "txtGrade2"
        Me.txtGrade2.TabIndex = 1
        Me.txtGrade2.Text = ""
        '
        'txtGrade3
        '
        Me.txtGrade3.Location = New System.Drawing.Point(24, 88)
        Me.txtGrade3.Name = "txtGrade3"
        Me.txtGrade3.TabIndex = 2
        Me.txtGrade3.Text = ""
        '
        'txtGrade4
        '
        Me.txtGrade4.Location = New System.Drawing.Point(24, 120)
        Me.txtGrade4.Name = "txtGrade4"
        Me.txtGrade4.TabIndex = 3
        Me.txtGrade4.Text = ""
        '
        'txtGrade5
        '
        Me.txtGrade5.Location = New System.Drawing.Point(24, 152)
        Me.txtGrade5.Name = "txtGrade5"
        Me.txtGrade5.TabIndex = 4
        Me.txtGrade5.Text = ""
        '
        'txtGrade6
        '
        Me.txtGrade6.Location = New System.Drawing.Point(24, 184)
        Me.txtGrade6.Name = "txtGrade6"
        Me.txtGrade6.TabIndex = 5
        Me.txtGrade6.Text = ""
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(176, 56)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 6
        Me.Button1.Text = "Button1"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.txtGrade6, Me.txtGrade5, Me.txtGrade4, Me.txtGrade3, Me.txtGrade2, Me.txtGrade1})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sngAverage As Single
        Dim intGrade1 As Integer
        Dim intGrade2 As Integer
        Dim intGrade3 As Integer
        Dim intGrade4 As Integer
        Dim intGrade5 As Integer
        Dim intgrade6 As Integer

        If txtGrade1.Text = "" Or txtGrade2.Text = "" Or _
            txtGrade3.Text = "" Or txtGrade4.Text = "" Or _
            txtGrade5.Text = "" Or txtGrade6.Text = "" Then
            MsgBox("You must fill in all 6 grades")
            Exit Sub
        End If

        intGrade1 = CInt(txtGrade1.Text)
        intGrade2 = CInt(txtGrade2.Text)
        intGrade3 = CInt(txtGrade3.Text)
        intGrade4 = CInt(txtGrade4.Text)
        intGrade5 = CInt(txtGrade5.Text)
        intgrade6 = CInt(txtGrade6.Text)

        sngAverage = (intGrade1 + intGrade2 + intGrade3 + _
                        intGrade4 + intGrade5 + intgrade6) / 6

        Console.WriteLine("The class average is " & sngAverage)

    End Sub
End Class
