Public Class frmChange 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 IdPayed As System.Windows.Forms.Label Friend WithEvents IdChange As System.Windows.Forms.Label Friend WithEvents IdOwes As System.Windows.Forms.Label Friend WithEvents IdDollars As System.Windows.Forms.Label Friend WithEvents IdNickels As System.Windows.Forms.Label Friend WithEvents IdDimes As System.Windows.Forms.Label Friend WithEvents IdQuarters As System.Windows.Forms.Label Friend WithEvents ChangeTextBox As System.Windows.Forms.Label Friend WithEvents PayedTextBox As System.Windows.Forms.TextBox Friend WithEvents DollarsTextBox As System.Windows.Forms.Label Friend WithEvents OwesTextBox As System.Windows.Forms.TextBox Friend WithEvents IdPennies As System.Windows.Forms.Label Friend WithEvents PenniesTextBox As System.Windows.Forms.Label Friend WithEvents NickelsTextBox As System.Windows.Forms.Label Friend WithEvents DimesTextBox As System.Windows.Forms.Label Friend WithEvents QuartersTextBox As System.Windows.Forms.Label Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmChange)) Me.IdPayed = New System.Windows.Forms.Label Me.HeadingLabel = New System.Windows.Forms.Label Me.ExitButton = New System.Windows.Forms.Button Me.CalcButton = New System.Windows.Forms.Button Me.ChangeTextBox = New System.Windows.Forms.Label Me.PayedTextBox = New System.Windows.Forms.TextBox Me.DollarsTextBox = New System.Windows.Forms.Label Me.OwesTextBox = New System.Windows.Forms.TextBox Me.ClearButton = New System.Windows.Forms.Button Me.IdChange = New System.Windows.Forms.Label Me.IdDollars = New System.Windows.Forms.Label Me.IdOwes = New System.Windows.Forms.Label Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components) Me.PictureBox1 = New System.Windows.Forms.PictureBox Me.IdPennies = New System.Windows.Forms.Label Me.PenniesTextBox = New System.Windows.Forms.Label Me.IdNickels = New System.Windows.Forms.Label Me.NickelsTextBox = New System.Windows.Forms.Label Me.IdDimes = New System.Windows.Forms.Label Me.DimesTextBox = New System.Windows.Forms.Label Me.IdQuarters = New System.Windows.Forms.Label Me.QuartersTextBox = New System.Windows.Forms.Label Me.SuspendLayout() ' 'IdPayed ' Me.IdPayed.Anchor = System.Windows.Forms.AnchorStyles.Top Me.IdPayed.AutoSize = True Me.IdPayed.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.IdPayed.Location = New System.Drawing.Point(112, 208) Me.IdPayed.Name = "IdPayed" Me.IdPayed.Size = New System.Drawing.Size(106, 19) Me.IdPayed.TabIndex = 3 Me.IdPayed.Text = "Customer Payed:" ' 'HeadingLabel ' Me.HeadingLabel.Anchor = System.Windows.Forms.AnchorStyles.Top Me.HeadingLabel.AutoSize = True Me.HeadingLabel.Font = New System.Drawing.Font("Tahoma", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.HeadingLabel.Location = New System.Drawing.Point(292, 64) Me.HeadingLabel.Name = "HeadingLabel" Me.HeadingLabel.Size = New System.Drawing.Size(163, 29) Me.HeadingLabel.TabIndex = 1 Me.HeadingLabel.Text = "Change Maker" ' '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(400, 392) 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(152, 392) Me.CalcButton.Name = "CalcButton" Me.CalcButton.Size = New System.Drawing.Size(112, 24) Me.CalcButton.TabIndex = 3 Me.CalcButton.Text = "Calculate Order" ' 'ChangeTextBox ' Me.ChangeTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Me.ChangeTextBox.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte), CType(192, Byte)) Me.ChangeTextBox.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.ChangeTextBox.Location = New System.Drawing.Point(248, 272) Me.ChangeTextBox.Name = "ChangeTextBox" Me.ChangeTextBox.Size = New System.Drawing.Size(80, 23) Me.ChangeTextBox.TabIndex = 8 ' 'PayedTextBox ' Me.PayedTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Me.PayedTextBox.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.PayedTextBox.Location = New System.Drawing.Point(248, 200) Me.PayedTextBox.Name = "PayedTextBox" Me.PayedTextBox.Size = New System.Drawing.Size(80, 23) Me.PayedTextBox.TabIndex = 2 Me.PayedTextBox.Text = "" ' 'DollarsTextBox ' Me.DollarsTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Me.DollarsTextBox.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.DollarsTextBox.Location = New System.Drawing.Point(496, 136) Me.DollarsTextBox.Name = "DollarsTextBox" Me.DollarsTextBox.Size = New System.Drawing.Size(80, 23) Me.DollarsTextBox.TabIndex = 22 ' 'OwesTextBox ' Me.OwesTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Me.OwesTextBox.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.OwesTextBox.Location = New System.Drawing.Point(248, 144) Me.OwesTextBox.Name = "OwesTextBox" Me.OwesTextBox.Size = New System.Drawing.Size(80, 23) Me.OwesTextBox.TabIndex = 1 Me.OwesTextBox.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(280, 392) Me.ClearButton.Name = "ClearButton" Me.ClearButton.Size = New System.Drawing.Size(112, 24) Me.ClearButton.TabIndex = 4 Me.ClearButton.Text = "Clear Screen" ' 'IdChange ' Me.IdChange.Anchor = System.Windows.Forms.AnchorStyles.Top Me.IdChange.AutoSize = True Me.IdChange.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.IdChange.Location = New System.Drawing.Point(112, 280) Me.IdChange.Name = "IdChange" Me.IdChange.Size = New System.Drawing.Size(120, 19) Me.IdChange.TabIndex = 4 Me.IdChange.Text = "Amount of Change:" ' 'IdDollars ' Me.IdDollars.Anchor = System.Windows.Forms.AnchorStyles.Top Me.IdDollars.AutoSize = True Me.IdDollars.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.IdDollars.Location = New System.Drawing.Point(424, 136) Me.IdDollars.Name = "IdDollars" Me.IdDollars.Size = New System.Drawing.Size(50, 19) Me.IdDollars.TabIndex = 5 Me.IdDollars.Text = "Dollars:" ' 'IdOwes ' Me.IdOwes.Anchor = System.Windows.Forms.AnchorStyles.Top Me.IdOwes.AutoSize = True Me.IdOwes.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.IdOwes.Location = New System.Drawing.Point(112, 152) Me.IdOwes.Name = "IdOwes" Me.IdOwes.Size = New System.Drawing.Size(103, 19) Me.IdOwes.TabIndex = 2 Me.IdOwes.Text = "Customer Owes:" ' '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(132, 8) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(88, 80) Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.PictureBox1.TabIndex = 25 Me.PictureBox1.TabStop = False ' 'IdPennies ' Me.IdPennies.Anchor = System.Windows.Forms.AnchorStyles.Top Me.IdPennies.AutoSize = True Me.IdPennies.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.IdPennies.Location = New System.Drawing.Point(424, 304) Me.IdPennies.Name = "IdPennies" Me.IdPennies.Size = New System.Drawing.Size(55, 19) Me.IdPennies.TabIndex = 26 Me.IdPennies.Text = "Pennies:" ' 'PenniesTextBox ' Me.PenniesTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Me.PenniesTextBox.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.PenniesTextBox.Location = New System.Drawing.Point(496, 304) Me.PenniesTextBox.Name = "PenniesTextBox" Me.PenniesTextBox.Size = New System.Drawing.Size(80, 23) Me.PenniesTextBox.TabIndex = 27 ' 'IdNickels ' Me.IdNickels.Anchor = System.Windows.Forms.AnchorStyles.Top Me.IdNickels.AutoSize = True Me.IdNickels.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.IdNickels.Location = New System.Drawing.Point(424, 262) Me.IdNickels.Name = "IdNickels" Me.IdNickels.Size = New System.Drawing.Size(50, 19) Me.IdNickels.TabIndex = 28 Me.IdNickels.Text = "Nickels:" ' 'NickelsTextBox ' Me.NickelsTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Me.NickelsTextBox.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.NickelsTextBox.Location = New System.Drawing.Point(496, 264) Me.NickelsTextBox.Name = "NickelsTextBox" Me.NickelsTextBox.Size = New System.Drawing.Size(80, 23) Me.NickelsTextBox.TabIndex = 29 ' 'IdDimes ' Me.IdDimes.Anchor = System.Windows.Forms.AnchorStyles.Top Me.IdDimes.AutoSize = True Me.IdDimes.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.IdDimes.Location = New System.Drawing.Point(424, 220) Me.IdDimes.Name = "IdDimes" Me.IdDimes.Size = New System.Drawing.Size(46, 19) Me.IdDimes.TabIndex = 30 Me.IdDimes.Text = "Dimes:" ' 'DimesTextBox ' Me.DimesTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Me.DimesTextBox.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.DimesTextBox.Location = New System.Drawing.Point(496, 216) Me.DimesTextBox.Name = "DimesTextBox" Me.DimesTextBox.Size = New System.Drawing.Size(80, 23) Me.DimesTextBox.TabIndex = 31 ' 'IdQuarters ' Me.IdQuarters.Anchor = System.Windows.Forms.AnchorStyles.Top Me.IdQuarters.AutoSize = True Me.IdQuarters.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.IdQuarters.Location = New System.Drawing.Point(424, 178) Me.IdQuarters.Name = "IdQuarters" Me.IdQuarters.Size = New System.Drawing.Size(61, 19) Me.IdQuarters.TabIndex = 32 Me.IdQuarters.Text = "Quarters:" ' 'QuartersTextBox ' Me.QuartersTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Me.QuartersTextBox.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.QuartersTextBox.Location = New System.Drawing.Point(496, 176) Me.QuartersTextBox.Name = "QuartersTextBox" Me.QuartersTextBox.Size = New System.Drawing.Size(80, 23) Me.QuartersTextBox.TabIndex = 33 ' 'frmChange ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) Me.ClientSize = New System.Drawing.Size(688, 526) Me.Controls.Add(Me.IdQuarters) Me.Controls.Add(Me.QuartersTextBox) Me.Controls.Add(Me.IdDimes) Me.Controls.Add(Me.DimesTextBox) Me.Controls.Add(Me.IdNickels) Me.Controls.Add(Me.NickelsTextBox) Me.Controls.Add(Me.IdPennies) Me.Controls.Add(Me.PenniesTextBox) Me.Controls.Add(Me.PictureBox1) Me.Controls.Add(Me.PayedTextBox) Me.Controls.Add(Me.OwesTextBox) Me.Controls.Add(Me.IdDollars) Me.Controls.Add(Me.IdChange) Me.Controls.Add(Me.IdPayed) Me.Controls.Add(Me.IdOwes) Me.Controls.Add(Me.HeadingLabel) Me.Controls.Add(Me.ExitButton) Me.Controls.Add(Me.ClearButton) Me.Controls.Add(Me.CalcButton) Me.Controls.Add(Me.DollarsTextBox) Me.Controls.Add(Me.ChangeTextBox) 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 = "frmChange" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Amount of Change" 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.OwesTextBox.Text = "" Me.PayedTextBox.Text = "" Me.ChangeTextBox.Text = "" Me.DollarsTextBox.Text = "" Me.QuartersTextBox.Text = "" Me.DimesTextBox.Text = "" Me.NickelsTextBox.Text = "" Me.PenniesTextBox.Text = "" 'set the focus on the Name textbox Me.OwesTextBox.Focus() End Sub Private Sub CalcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalcButton.Click Dim dblChange As Double dblChange = (CDbl(Me.PayedTextBox.Text) - CDbl(Me.OwesTextBox.Text)) Me.ChangeTextBox.Text = Format(CStr(dblChange), "currency") If (dblChange > 0) Then dblChange = dblChange * 100 Me.DollarsTextBox.Text = dblChange \ 100 dblChange = dblChange - ((Val(Me.DollarsTextBox.Text)) * 100) Me.QuartersTextBox.Text = dblChange \ 25 dblChange = dblChange - ((Val(Me.QuartersTextBox.Text)) * 25) Me.DimesTextBox.Text = dblChange \ 10 dblChange = dblChange - ((Val(Me.DimesTextBox.Text)) * 10) Me.NickelsTextBox.Text = dblChange \ 5 dblChange = dblChange - ((Val(Me.NickelsTextBox.Text)) * 5) Me.PenniesTextBox.Text = dblChange \ 1 End If 'set the focus on the Clear Screen button Me.ClearButton.Focus() End Sub Private Sub OwesTextBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles OwesTextBox.LostFocus Me.OwesTextBox.Text = Format(Me.OwesTextBox.Text, "currency") End Sub Private Sub PayedTextBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles PayedTextBox.LostFocus Me.PayedTextBox.Text = Format(Me.PayedTextBox.Text, "currency") End Sub End Class