All pastes #40968 Raw Edit

Full code

public text v1 · immutable
#40968 ·published 2006-02-10 02:30 UTC
rendered paste body
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 btnAddSc As System.Windows.Forms.Button
    Friend WithEvents btnCalcStats As System.Windows.Forms.Button
    Friend WithEvents btnClear As System.Windows.Forms.Button
    Friend WithEvents lstCalc As System.Windows.Forms.ListBox
    Friend WithEvents lstScoreIn As System.Windows.Forms.ListBox
    Friend WithEvents lblNumScores As System.Windows.Forms.Label
    Friend WithEvents lblHighSc As System.Windows.Forms.Label
    Friend WithEvents lblLowSc As System.Windows.Forms.Label
    Friend WithEvents lblNumScoreDisplay As System.Windows.Forms.Label
    Friend WithEvents lblHighDisplay As System.Windows.Forms.Label
    Friend WithEvents lblLowDisplay As System.Windows.Forms.Label
    Friend WithEvents btnExit As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.btnAddSc = New System.Windows.Forms.Button
        Me.btnCalcStats = New System.Windows.Forms.Button
        Me.btnClear = New System.Windows.Forms.Button
        Me.lstCalc = New System.Windows.Forms.ListBox
        Me.lstScoreIn = New System.Windows.Forms.ListBox
        Me.lblNumScores = New System.Windows.Forms.Label
        Me.lblHighSc = New System.Windows.Forms.Label
        Me.lblLowSc = New System.Windows.Forms.Label
        Me.lblNumScoreDisplay = New System.Windows.Forms.Label
        Me.lblHighDisplay = New System.Windows.Forms.Label
        Me.lblLowDisplay = New System.Windows.Forms.Label
        Me.btnExit = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'btnAddSc
        '
        Me.btnAddSc.Location = New System.Drawing.Point(240, 24)
        Me.btnAddSc.Name = "btnAddSc"
        Me.btnAddSc.Size = New System.Drawing.Size(48, 32)
        Me.btnAddSc.TabIndex = 2
        Me.btnAddSc.Text = "Add Score"
        '
        'btnCalcStats
        '
        Me.btnCalcStats.Location = New System.Drawing.Point(240, 64)
        Me.btnCalcStats.Name = "btnCalcStats"
        Me.btnCalcStats.Size = New System.Drawing.Size(48, 32)
        Me.btnCalcStats.TabIndex = 3
        Me.btnCalcStats.Text = "Calc Stats"
        '
        'btnClear
        '
        Me.btnClear.Location = New System.Drawing.Point(240, 104)
        Me.btnClear.Name = "btnClear"
        Me.btnClear.Size = New System.Drawing.Size(48, 32)
        Me.btnClear.TabIndex = 4
        Me.btnClear.Text = "Clear"
        '
        'lstCalc
        '
        Me.lstCalc.Location = New System.Drawing.Point(112, 64)
        Me.lstCalc.Name = "lstCalc"
        Me.lstCalc.Size = New System.Drawing.Size(80, 121)
        Me.lstCalc.TabIndex = 5
        '
        'lstScoreIn
        '
        Me.lstScoreIn.Location = New System.Drawing.Point(8, 64)
        Me.lstScoreIn.Name = "lstScoreIn"
        Me.lstScoreIn.Size = New System.Drawing.Size(80, 121)
        Me.lstScoreIn.TabIndex = 6
        '
        'lblNumScores
        '
        Me.lblNumScores.Location = New System.Drawing.Point(16, 200)
        Me.lblNumScores.Name = "lblNumScores"
        Me.lblNumScores.Size = New System.Drawing.Size(72, 24)
        Me.lblNumScores.TabIndex = 7
        Me.lblNumScores.Text = "# of Scores:"
        Me.lblNumScores.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'lblHighSc
        '
        Me.lblHighSc.Location = New System.Drawing.Point(16, 232)
        Me.lblHighSc.Name = "lblHighSc"
        Me.lblHighSc.Size = New System.Drawing.Size(72, 24)
        Me.lblHighSc.TabIndex = 8
        Me.lblHighSc.Text = "High Score:"
        Me.lblHighSc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'lblLowSc
        '
        Me.lblLowSc.Location = New System.Drawing.Point(16, 264)
        Me.lblLowSc.Name = "lblLowSc"
        Me.lblLowSc.Size = New System.Drawing.Size(72, 24)
        Me.lblLowSc.TabIndex = 9
        Me.lblLowSc.Text = "Low Score:"
        Me.lblLowSc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'lblNumScoreDisplay
        '
        Me.lblNumScoreDisplay.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.lblNumScoreDisplay.Location = New System.Drawing.Point(112, 200)
        Me.lblNumScoreDisplay.Name = "lblNumScoreDisplay"
        Me.lblNumScoreDisplay.Size = New System.Drawing.Size(48, 24)
        Me.lblNumScoreDisplay.TabIndex = 10
        '
        'lblHighDisplay
        '
        Me.lblHighDisplay.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.lblHighDisplay.Location = New System.Drawing.Point(112, 232)
        Me.lblHighDisplay.Name = "lblHighDisplay"
        Me.lblHighDisplay.Size = New System.Drawing.Size(48, 24)
        Me.lblHighDisplay.TabIndex = 11
        '
        'lblLowDisplay
        '
        Me.lblLowDisplay.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.lblLowDisplay.Location = New System.Drawing.Point(112, 264)
        Me.lblLowDisplay.Name = "lblLowDisplay"
        Me.lblLowDisplay.Size = New System.Drawing.Size(48, 24)
        Me.lblLowDisplay.TabIndex = 12
        '
        'btnExit
        '
        Me.btnExit.Location = New System.Drawing.Point(240, 248)
        Me.btnExit.Name = "btnExit"
        Me.btnExit.Size = New System.Drawing.Size(56, 40)
        Me.btnExit.TabIndex = 13
        Me.btnExit.Text = "Exit"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(312, 301)
        Me.Controls.Add(Me.btnExit)
        Me.Controls.Add(Me.lblLowDisplay)
        Me.Controls.Add(Me.lblHighDisplay)
        Me.Controls.Add(Me.lblNumScoreDisplay)
        Me.Controls.Add(Me.lblLowSc)
        Me.Controls.Add(Me.lblHighSc)
        Me.Controls.Add(Me.lblNumScores)
        Me.Controls.Add(Me.lstScoreIn)
        Me.Controls.Add(Me.lstCalc)
        Me.Controls.Add(Me.btnClear)
        Me.Controls.Add(Me.btnCalcStats)
        Me.Controls.Add(Me.btnAddSc)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim intScores As Integer() = New Integer(25) {}
    Dim myIndex As Integer = 0
    Dim high As Integer = 0
    Dim low As Integer = 100
    Dim myScore As String




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

    Private Sub btnAddSc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddSc.Click

        If (myIndex = 24) Then
            btnAddSc.Enabled = False

        ElseIf (myScore = "") Then
            MsgBox("No score entered")
            Exit Sub

        End If
        intScores(myIndex) = Val(myScore)
        lstScoreIn.Items.Add(intScores(myIndex))
        lblNumScoreDisplay.Text = myIndex + 1

        If (high < intScores(myIndex)) Then
            high = intScores(myIndex)
            lblHighDisplay.Text = high

        ElseIf (low > intScores(myIndex)) Then
            low = intScores(myIndex)
            lblLowDisplay.Text = low

        End If

        myIndex += 1
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim prompt As String
        Dim inX, inY As Integer

        prompt = "Score (0-100)"
        inX = 112
        inY = 16

        myScore = InputBox(prompt, , "0", inX, inY)
    End Sub
End Class