' Over90 Example ' Enter scores sequentially. Output count of scores >= 90. 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 txtScore As System.Windows.Forms.TextBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents txtCount As System.Windows.Forms.TextBox Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents btnEnter As System.Windows.Forms.Button Friend WithEvents btnShowCount As System.Windows.Forms.Button Friend WithEvents btnReset As System.Windows.Forms.Button Private Sub InitializeComponent() Me.txtScore = New System.Windows.Forms.TextBox Me.Label1 = New System.Windows.Forms.Label Me.txtCount = New System.Windows.Forms.TextBox Me.Label2 = New System.Windows.Forms.Label Me.btnEnter = New System.Windows.Forms.Button Me.btnShowCount = New System.Windows.Forms.Button Me.btnReset = New System.Windows.Forms.Button Me.SuspendLayout() ' 'txtScore ' Me.txtScore.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.txtScore.Location = New System.Drawing.Point(56, 16) Me.txtScore.Name = "txtScore" Me.txtScore.Size = New System.Drawing.Size(152, 29) Me.txtScore.TabIndex = 0 Me.txtScore.Text = "" ' 'Label1 ' Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(96, 56) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(64, 24) Me.Label1.TabIndex = 1 Me.Label1.Text = "Score" ' 'txtCount ' Me.txtCount.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.txtCount.Location = New System.Drawing.Point(56, 96) Me.txtCount.Name = "txtCount" Me.txtCount.ReadOnly = True Me.txtCount.Size = New System.Drawing.Size(152, 29) Me.txtCount.TabIndex = 2 Me.txtCount.Text = "0" ' 'Label2 ' Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label2.Location = New System.Drawing.Point(8, 136) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(232, 24) Me.Label2.TabIndex = 3 Me.Label2.Text = "Count of Scores over 90" ' 'btnEnter ' Me.btnEnter.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnEnter.Location = New System.Drawing.Point(224, 16) Me.btnEnter.Name = "btnEnter" Me.btnEnter.Size = New System.Drawing.Size(168, 32) Me.btnEnter.TabIndex = 4 Me.btnEnter.Text = "Enter Score" ' 'btnShowCount ' Me.btnShowCount.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnShowCount.Location = New System.Drawing.Point(224, 56) Me.btnShowCount.Name = "btnShowCount" Me.btnShowCount.Size = New System.Drawing.Size(168, 32) Me.btnShowCount.TabIndex = 5 Me.btnShowCount.Text = "Show Count" ' 'btnReset ' Me.btnReset.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnReset.Location = New System.Drawing.Point(224, 96) Me.btnReset.Name = "btnReset" Me.btnReset.Size = New System.Drawing.Size(168, 32) Me.btnReset.TabIndex = 6 Me.btnReset.Text = "Reset" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(424, 174) Me.Controls.Add(Me.btnReset) Me.Controls.Add(Me.btnShowCount) Me.Controls.Add(Me.btnEnter) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.txtCount) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.txtScore) Me.Name = "Form1" Me.Text = "Over90 Example" Me.ResumeLayout(False) End Sub #End Region Private count As Integer = 0 Private Sub btnEnter_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnEnter.Click If txtScore.Text >= 90 Then count += 1 End If End Sub Private Sub btnShowCount_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnShowCount.Click txtCount.Text = count End Sub Private Sub btnReset_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnReset.Click count = 0 txtCount.Text = 0 txtScore.Clear() txtScore.Focus() End Sub End Class