PROGRAMMING WITH MICROSOFT VIS PKG
PROGRAMMING WITH MICROSOFT VIS PKG
7th Edition
ISBN: 9781337088152
Author: ZAK
Publisher: CENGAGE L
Question
Book Icon
Chapter 3.LB, Problem 6E
Program Plan Intro

Meyer’s Purple Bakery

Create a Visual Basic Windows Application:

  • Open Microsoft Visual Basic 2010.
  • Click “File” Menu -> “New Project”.
  • In the New Project pop-up window, select the “Windows Form Application” and give the name as “Bakery Project”, and specify the location as “\VB2015\Chap01\”.

Form Design:

  • Design the main form and print form by placing the labels, textbox, and button and then change their name and properties.
  • Inside the “Calculate” button,
    • Calculate total sales, sales tax and sales clerk’s name..
  • Inside the “Print” button,
    • Print the form data.
  • Inside the “Clear” button,
    • Clear the screen.
  • Inside the “Exit” button,
    • Close the form.

Screenshot of the Main form design

PROGRAMMING WITH MICROSOFT VIS PKG, Chapter 3.LB, Problem 6E , additional homework tip  1

Screenshot of the Name Entry form design

PROGRAMMING WITH MICROSOFT VIS PKG, Chapter 3.LB, Problem 6E , additional homework tip  2

Screenshot of the Item price form design

PROGRAMMING WITH MICROSOFT VIS PKG, Chapter 3.LB, Problem 6E , additional homework tip  3

Expert Solution & Answer
Check Mark

Explanation of Solution

Program:

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Partial Class frmMain

    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.

    <System.Diagnostics.DebuggerNonUserCode()> _

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)

        Try

            If disposing AndAlso components IsNot Nothing Then

                components.Dispose()

            End If

        Finally

            MyBase.Dispose(disposing)

        End Try

    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.

    <System.Diagnostics.DebuggerStepThrough()> _

    Private Sub InitializeComponent()

        Me.components = New System.ComponentModel.Container()

        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain))

        Me.lblTotalSales = New System.Windows.Forms.Label()

        Me.lblTotalItems = New System.Windows.Forms.Label()

        Me.txtDate = New System.Windows.Forms.TextBox()

        Me.btnExit = New System.Windows.Forms.Button()

        Me.btnPrint = New System.Windows.Forms.Button()

        Me.btnClear = New System.Windows.Forms.Button()

        Me.btnCalc = New System.Windows.Forms.Button()

        Me.Label5 = New System.Windows.Forms.Label()

        Me.Label4 = New System.Windows.Forms.Label()

        Me.Label3 = New System.Windows.Forms.Label()

        Me.Label2 = New System.Windows.Forms.Label()

        Me.Label1 = New System.Windows.Forms.Label()

        Me.txtDonuts = New System.Windows.Forms.TextBox()

        Me.PictureBox1 = New System.Windows.Forms.PictureBox()

        Me.Label6 = New System.Windows.Forms.Label()

        Me.txtMuffins = New System.Windows.Forms.TextBox()

        Me.PrintForm1 = New Microsoft.VisualBasic.PowerPacks.Printing.PrintForm(Me.components)

        Me.lblMsg = New System.Windows.Forms.Label()

        CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).BeginInit

        Me.SuspendLayout

        '

        'lblTotalSales

        '

        Me.lblTotalSales.BackColor = System.Drawing.Color.FromArgb(CType(CType(255,Byte),Integer), CType(CType(255,Byte),Integer), CType(CType(192,Byte),Integer))

        Me.lblTotalSales.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

        Me.lblTotalSales.Location = New System.Drawing.Point(110, 230)

        Me.lblTotalSales.Name = "lblTotalSales"

        Me.lblTotalSales.Size = New System.Drawing.Size(94, 27)

        Me.lblTotalSales.TabIndex = 14

        Me.lblTotalSales.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

        '

        'lblTotalItems

        '

        Me.lblTotalItems.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

        Me.lblTotalItems.Location = New System.Drawing.Point(110, 187)

        Me.lblTotalItems.Name = "lblTotalItems"

        Me.lblTotalItems.Size = New System.Drawing.Size(47, 27)

        Me.lblTotalItems.TabIndex = 13

        Me.lblTotalItems.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

        '

        'txtDate

        '

        Me.txtDate.Location = New System.Drawing.Point(156, 67)

        Me.txtDate.Name = "txtDate"

        Me.txtDate.Size = New System.Drawing.Size(111, 27)

        Me.txtDate.TabIndex = 1

        '

        'btnExit

        '

        Me.btnExit.Location = New System.Drawing.Point(228, 216)

        Me.btnExit.Name = "btnExit"

        Me.btnExit.Size = New System.Drawing.Size(114, 31)

        Me.btnExit.TabIndex = 9

        Me.btnExit.Text = "E&xit"

        Me.btnExit.UseVisualStyleBackColor = true

        '

        'btnPrint

        '

        Me.btnPrint.Location = New System.Drawing.Point(228, 148)

        Me.btnPrint.Name = "btnPrint"

        Me.btnPrint.Size = New System.Drawing.Size(114, 31)

        Me.btnPrint.TabIndex = 7

        Me.btnPrint.Text = "&Print Receipt"

        Me.btnPrint.UseVisualStyleBackColor = true

        '

        'btnClear

        '

        Me.btnClear.Location = New System.Drawing.Point(228, 182)

        Me.btnClear.Name = "btnClear"

        Me.btnClear.Size = New System.Drawing.Size(114, 31)

        Me.btnClear.TabIndex = 8

        Me.btnClear.Text = "C&lear Screen"

        Me.btnClear.UseVisualStyleBackColor = true

        '

        'btnCalc

        '

        Me.btnCalc.Location = New System.Drawing.Point(228, 114)

        Me.btnCalc.Name = "btnCalc"

        Me.btnCalc.Size = New System.Drawing.Size(114, 31)

        Me.btnCalc.TabIndex = 6

        Me.btnCalc.Text = "&Calculate"

        Me.btnCalc.UseVisualStyleBackColor = true

        '

        'Label5

        '

        Me.Label5.AutoSize = true

        Me.Label5.Location = New System.Drawing.Point(24, 190)

        Me.Label5.Name = "Label5"

        Me.Label5.Size = New System.Drawing.Size(86, 20)

        Me.Label5.TabIndex = 11

        Me.Label5.Text = "Total items:"

        '

        'Label4

        '

        Me.Label4.AutoSize = true

        Me.Label4.Location = New System.Drawing.Point(24, 153)

        Me.Label4.Name = "Label4"

        Me.Label4.Size = New System.Drawing.Size(61, 20)

        Me.Label4.TabIndex = 4

        Me.Label4.Text = "&Muffins:"

        '

        'Label3

        '

        Me.Label3.AutoSize = true

        Me.Label3.Location = New System.Drawing.Point(24, 114)

        Me.Label3.Name = "Label3"

        Me.Label3.Size = New System.Drawing.Size(84, 20)

        Me.Label3.TabIndex = 2

        Me.Label3.Text = "&Doughnuts:"

        '

        'Label2

        '

        Me.Label2.AutoSize = true

        Me.Label2.Location = New System.Drawing.Point(106, 70)

        Me.Label2.Name = "Label2"

        Me.Label2.Size = New System.Drawing.Size(44, 20)

        Me.Label2.TabIndex = 0

        Me.Label2.Text = "Da&te:"

        '

        'Label1

        '

        Me.Label1.AutoSize = true

        Me.Label1.Font = New System.Drawing.Font("Segoe UI", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte))

        Me.Label1.Location = New System.Drawing.Point(103, 18)

        Me.Label1.Name = "Label1"

        Me.Label1.Size = New System.Drawing.Size(172, 37)

        Me.Label1.TabIndex = 10

        Me.Label1.Text = "Sales Receipt"

        '

        'txtDonuts

        '

        Me.txtDonuts.Location = New System.Drawing.Point(110, 111)

        Me.txtDonuts.Name = "txtDonuts"

        Me.txtDonuts.Size = New System.Drawing.Size(47, 27)

        Me.txtDonuts.TabIndex = 3

        '

        'PictureBox1

        '

        Me.PictureBox1.Image = Global.Bakery_Project.My.Resources.Resources.Chef

        Me.PictureBox1.Location = New System.Drawing.Point(22, 12)

        Me.PictureBox1.Name = "PictureBox1"

        Me.PictureBox1.Size = New System.Drawing.Size(71, 68)

        Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage

        Me.PictureBox1.TabIndex = 34

        Me.PictureBox1.TabStop = false

        '

        'Label6

        '

        Me.Label6.AutoSize = true

        Me.Label6.Location = New System.Drawing.Point(24, 230)

        Me.Label6.Name = "Label6"

        Me.Label6.Size = New System.Drawing.Size(82, 20)

        Me.Label6.TabIndex = 12

        Me.Label6.Text = "Total sales:"

        '

        'txtMuffins

        '

        Me.txtMuffins.Location = New System.Drawing.Point(110, 148)

        Me.txtMuffins.Name = "txtMuffins"

        Me.txtMuffins.Size = New System.Drawing.Size(47, 27)

        Me.txtMuffins.TabIndex = 5

        '

        'PrintForm1

        '

        Me.PrintForm1.DocumentName = "document"

        Me.PrintForm1.Form = Me

        Me.PrintForm1.PrintAction = System.Drawing.Printing.PrintAction.PrintToPreview

        Me.PrintForm1.PrinterSettings = CType(resources.GetObject("PrintForm1.PrinterSettings"),System.Drawing.Printing.PrinterSettings)

        Me.PrintForm1.PrintFileName = Nothing

        '

        'lblMsg

        '

        Me.lblMsg.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

        Me.lblMsg.Location = New System.Drawing.Point(28, 276)

        Me.lblMsg.Name = "lblMsg"

        Me.lblMsg.Size = New System.Drawing.Size(314, 49)

        Me.lblMsg.TabIndex = 15

        Me.lblMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

        '

        'frmMain

        '

        Me.AcceptButton = Me.btnCalc

        Me.AutoScaleDimensions = New System.Drawing.SizeF(8!, 20!)

        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

        Me.ClientSize = New System.Drawing.Size(366, 346)

        Me.Controls.Add(Me.lblMsg)

        Me.Controls.Add(Me.txtMuffins)

        Me.Controls.Add(Me.Label6)

        Me.Controls.Add(Me.PictureBox1)

        Me.Controls.Add(Me.txtDonuts)

        Me.Controls.Add(Me.lblTotalSales)

        Me.Controls.Add(Me.lblTotalItems)

        Me.Controls.Add(Me.txtDate)

        Me.Controls.Add(Me.btnExit)

        Me.Controls.Add(Me.btnPrint)

        Me.Controls.Add(Me.btnClear)

        Me.Controls.Add(Me.btnCalc)

        Me.Controls.Add(Me.Label5)

        Me.Controls.Add(Me.Label4)

        Me.Controls.Add(Me.Label3)

        Me.Controls.Add(Me.Label2)

        Me.Controls.Add(Me.Label1)

        Me.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte))

        Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)

        Me.Name = "frmMain"

        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen

        Me.Text = "Meyer's Purple Bakery"

        CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).EndInit

        Me.ResumeLayout(false)

        Me.PerformLayout

End Sub

    Friend WithEvents lblTotalSales As Label

    Friend WithEvents lblTotalItems As Label

    Friend WithEvents txtDate As TextBox

    Friend WithEvents btnExit As Button

    Friend WithEvents btnPrint As Button

    Friend WithEvents btnClear As Button

    Friend WithEvents btnCalc As Button

    Friend WithEvents Label5 As Label

    Friend WithEvents Label4 As Label

    Friend WithEvents Label3 As Label

    Friend WithEvents Label2 As Label

    Friend WithEvents Label1 As Label

    Friend WithEvents txtDonuts As TextBox

    Friend WithEvents PictureBox1 As PictureBox

    Friend WithEvents Label6 As Label

    Friend WithEvents txtMuffins As TextBox

    Friend WithEvents PrintForm1 As PowerPacks.Printing.PrintForm

    Friend WithEvents lblMsg As Label

End Class

Sample Output
  • Run the program, by pressing the F5.

    Screenshot of the output form

PROGRAMMING WITH MICROSOFT VIS PKG, Chapter 3.LB, Problem 6E , additional homework tip  4

Screenshot of Calculation after entering the quantity

PROGRAMMING WITH MICROSOFT VIS PKG, Chapter 3.LB, Problem 6E , additional homework tip  5

Screenshot of getting salesclerk’s name

PROGRAMMING WITH MICROSOFT VIS PKG, Chapter 3.LB, Problem 6E , additional homework tip  6

Screenshot of getting the item price

PROGRAMMING WITH MICROSOFT VIS PKG, Chapter 3.LB, Problem 6E , additional homework tip  7

Screenshot of Calculate

PROGRAMMING WITH MICROSOFT VIS PKG, Chapter 3.LB, Problem 6E , additional homework tip  8

Screenshot of Print Preview

PROGRAMMING WITH MICROSOFT VIS PKG, Chapter 3.LB, Problem 6E , additional homework tip  9

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!

Chapter 3 Solutions

PROGRAMMING WITH MICROSOFT VIS PKG

Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning