Public Class frmJohnson 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 Private components As System.ComponentModel.IContainer 'Required by the Windows Form Designer '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 HeadingLabel As System.Windows.Forms.Label Friend WithEvents ExitButton As System.Windows.Forms.Button Friend WithEvents CalcButton As System.Windows.Forms.Button Friend WithEvents ClearButton As System.Windows.Forms.Button Friend WithEvents ImageList1 As System.Windows.Forms.ImageList Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox Friend WithEvents UnitsTextBox As System.Windows.Forms.TextBox Friend WithEvents IdUnits As System.Windows.Forms.Label Friend WithEvents rbtWholesaler As System.Windows.Forms.RadioButton Friend WithEvents rbtRetailer As System.Windows.Forms.RadioButton Friend WithEvents PriceTextBox As System.Windows.Forms.Label Friend WithEvents IdPrice As System.Windows.Forms.Label Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmJohnson)) Me.HeadingLabel = New System.Windows.Forms.Label Me.ExitButton = New System.Windows.Forms.Button Me.CalcButton = New System.Windows.Forms.Button Me.PriceTextBox = New System.Windows.Forms.Label Me.UnitsTextBox = New System.Windows.Forms.TextBox Me.ClearButton = New System.Windows.Forms.Button Me.IdPrice = New System.Windows.Forms.Label Me.IdUnits = New System.Windows.Forms.Label Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components) Me.PictureBox1 = New System.Windows.Forms.PictureBox Me.rbtWholesaler = New System.Windows.Forms.RadioButton Me.rbtRetailer = New System.Windows.Forms.RadioButton Me.GroupBox1 = New System.Windows.Forms.GroupBox Me.GroupBox1.SuspendLayout() Me.SuspendLayout() ' 'HeadingLabel ' Me.HeadingLabel.Anchor = System.Windows.Forms.AnchorStyles.Top Me.HeadingLabel.AutoSize = True Me.HeadingLabel.Font = New System.Drawing.Font("Tahoma", 18.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.HeadingLabel.Location = New System.Drawing.Point(332, 40) Me.HeadingLabel.Name = "HeadingLabel" Me.HeadingLabel.Size = New System.Drawing.Size(228, 32) Me.HeadingLabel.TabIndex = 1 Me.HeadingLabel.Text = "Johnson Products" ' 'ExitButton ' Me.ExitButton.Anchor = System.Windows.Forms.AnchorStyles.Top Me.ExitButton.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.ExitButton.Location = New System.Drawing.Point(432, 280) Me.ExitButton.Name = "ExitButton" Me.ExitButton.Size = New System.Drawing.Size(112, 24) Me.ExitButton.TabIndex = 5 Me.ExitButton.Text = "Exit" ' 'CalcButton ' Me.CalcButton.Anchor = System.Windows.Forms.AnchorStyles.Top Me.CalcButton.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.CalcButton.Location = New System.Drawing.Point(184, 280) Me.CalcButton.Name = "CalcButton" Me.CalcButton.Size = New System.Drawing.Size(112, 24) Me.CalcButton.TabIndex = 3 Me.CalcButton.Text = "Calculate Order" ' 'PriceTextBox ' Me.PriceTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Me.PriceTextBox.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte), CType(192, Byte)) Me.PriceTextBox.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.PriceTextBox.Location = New System.Drawing.Point(568, 160) Me.PriceTextBox.Name = "PriceTextBox" Me.PriceTextBox.Size = New System.Drawing.Size(80, 23) Me.PriceTextBox.TabIndex = 8 ' 'UnitsTextBox ' Me.UnitsTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Me.UnitsTextBox.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.UnitsTextBox.Location = New System.Drawing.Point(160, 160) Me.UnitsTextBox.Name = "UnitsTextBox" Me.UnitsTextBox.Size = New System.Drawing.Size(80, 23) Me.UnitsTextBox.TabIndex = 1 Me.UnitsTextBox.Text = "" ' 'ClearButton ' Me.ClearButton.Anchor = System.Windows.Forms.AnchorStyles.Top Me.ClearButton.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.ClearButton.Location = New System.Drawing.Point(312, 280) Me.ClearButton.Name = "ClearButton" Me.ClearButton.Size = New System.Drawing.Size(112, 24) Me.ClearButton.TabIndex = 4 Me.ClearButton.Text = "Clear Screen" ' 'IdPrice ' Me.IdPrice.Anchor = System.Windows.Forms.AnchorStyles.Top Me.IdPrice.AutoSize = True Me.IdPrice.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.IdPrice.Location = New System.Drawing.Point(480, 160) Me.IdPrice.Name = "IdPrice" Me.IdPrice.Size = New System.Drawing.Size(72, 19) Me.IdPrice.TabIndex = 4 Me.IdPrice.Text = "Total Price:" ' 'IdUnits ' Me.IdUnits.Anchor = System.Windows.Forms.AnchorStyles.Top Me.IdUnits.AutoSize = True Me.IdUnits.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.IdUnits.Location = New System.Drawing.Point(48, 160) Me.IdUnits.Name = "IdUnits" Me.IdUnits.Size = New System.Drawing.Size(106, 19) Me.IdUnits.TabIndex = 2 Me.IdUnits.Text = "Number of Units:" ' 'ImageList1 ' Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16) Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent ' 'PictureBox1 ' Me.PictureBox1.Anchor = System.Windows.Forms.AnchorStyles.Top Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image) Me.PictureBox1.Location = New System.Drawing.Point(104, 8) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(152, 80) Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.PictureBox1.TabIndex = 25 Me.PictureBox1.TabStop = False ' 'rbtWholesaler ' Me.rbtWholesaler.Anchor = System.Windows.Forms.AnchorStyles.Top Me.rbtWholesaler.Location = New System.Drawing.Point(20, 25) Me.rbtWholesaler.Name = "rbtWholesaler" Me.rbtWholesaler.Size = New System.Drawing.Size(84, 24) Me.rbtWholesaler.TabIndex = 26 Me.rbtWholesaler.Text = "Wholesaler" ' 'rbtRetailer ' Me.rbtRetailer.Anchor = System.Windows.Forms.AnchorStyles.Top Me.rbtRetailer.Location = New System.Drawing.Point(20, 57) Me.rbtRetailer.Name = "rbtRetailer" Me.rbtRetailer.Size = New System.Drawing.Size(84, 24) Me.rbtRetailer.TabIndex = 27 Me.rbtRetailer.Text = "Retailer" ' 'GroupBox1 ' Me.GroupBox1.Anchor = System.Windows.Forms.AnchorStyles.Top Me.GroupBox1.Controls.Add(Me.rbtWholesaler) Me.GroupBox1.Controls.Add(Me.rbtRetailer) Me.GroupBox1.Location = New System.Drawing.Point(296, 120) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(136, 88) Me.GroupBox1.TabIndex = 28 Me.GroupBox1.TabStop = False ' 'frmJohnson ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) Me.ClientSize = New System.Drawing.Size(768, 366) Me.Controls.Add(Me.GroupBox1) Me.Controls.Add(Me.PictureBox1) Me.Controls.Add(Me.UnitsTextBox) Me.Controls.Add(Me.IdPrice) Me.Controls.Add(Me.IdUnits) Me.Controls.Add(Me.HeadingLabel) Me.Controls.Add(Me.ExitButton) Me.Controls.Add(Me.ClearButton) Me.Controls.Add(Me.CalcButton) Me.Controls.Add(Me.PriceTextBox) Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.MaximizeBox = False Me.Name = "frmJohnson" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.GroupBox1.ResumeLayout(False) Me.ResumeLayout(False) End Sub #End Region Private Sub ExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExitButton.Click Me.Close() End Sub Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click Me.UnitsTextBox.Text = "" Me.rbtWholesaler.Checked = False Me.rbtRetailer.Checked = False Me.PriceTextBox.Text = "" 'set the focus on the Name textbox Me.UnitsTextBox.Focus() End Sub Private Sub CalcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalcButton.Click Dim intUnits As Single Dim intAmount As Single intUnits = Me.UnitsTextBox.Text If (rbtWholesaler.Checked = True) Then If (intUnits < 5) Then intAmount = (intUnits * 10) Else intAmount = (intUnits * 9) End If Else If (intUnits < 4) Then intAmount = (intUnits * 15) ElseIf (intUnits < 9) Then intAmount = (intUnits * 14) Else intAmount = (intUnits * 12) End If End If Me.PriceTextBox.Text = intAmount 'set the focus on the Clear Screen button Me.ClearButton.Focus() End Sub Private Sub UnitsTextBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles UnitsTextBox.LostFocus If Me.UnitsTextBox.Text = "" Then Me.UnitsTextBox.Text = 0 Else Me.UnitsTextBox.Text = CInt(Me.UnitsTextBox.Text) End If End Sub Private Sub PriceTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles PriceTextBox.TextChanged Me.PriceTextBox.Text = Format(Me.PriceTextBox.Text, "currency") End Sub End Class