
Cranston Berries
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 “Cranston 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 the projected sales.
- 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 form design

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.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.txtProjIncrease = New System.Windows.Forms.TextBox()
Me.txtStraw = New System.Windows.Forms.TextBox()
Me.txtBlue = New System.Windows.Forms.TextBox()
Me.txtRasp = New System.Windows.Forms.TextBox()
Me.Label5 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.lblStraw = New System.Windows.Forms.Label()
Me.lblBlue = New System.Windows.Forms.Label()
Me.lblRasp = New System.Windows.Forms.Label()
Me.btnCalc = New System.Windows.Forms.Button()
Me.btnPrint = New System.Windows.Forms.Button()
Me.btnClear = New System.Windows.Forms.Button()
Me.btnExit = New System.Windows.Forms.Button()
Me.PrintForm1 = New Microsoft.VisualBasic.PowerPacks.Printing.PrintForm(Me.components)
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(27, 26)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(268, 20)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Projected &increase % (in decimal form):"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(27, 108)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(94, 20)
Me.Label2.TabIndex = 2
Me.Label2.Text = "&Strawberries:"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(27, 157)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(86, 20)
Me.Label3.TabIndex = 4
Me.Label3.Text = "&Blueberries:"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(27, 203)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(89, 20)
Me.Label4.TabIndex = 6
Me.Label4.Text = "&Raspberries:"
'
'txtProjIncrease
'
Me.txtProjIncrease.Location = New System.Drawing.Point(301, 23)
Me.txtProjIncrease.Name = "txtProjIncrease"
Me.txtProjIncrease.Size = New System.Drawing.Size(57, 27)
Me.txtProjIncrease.TabIndex = 1
'
'txtStraw
'
Me.txtStraw.Location = New System.Drawing.Point(122, 105)
Me.txtStraw.Name = "txtStraw"
Me.txtStraw.Size = New System.Drawing.Size(100, 27)
Me.txtStraw.TabIndex = 3
'
'txtBlue
'
Me.txtBlue.Location = New System.Drawing.Point(122, 154)
Me.txtBlue.Name = "txtBlue"
Me.txtBlue.Size = New System.Drawing.Size(100, 27)
Me.txtBlue.TabIndex = 5
'
'txtRasp
'
Me.txtRasp.Location = New System.Drawing.Point(122, 200)
Me.txtRasp.Name = "txtRasp"
Me.txtRasp.Size = New System.Drawing.Size(100, 27)
Me.txtRasp.TabIndex = 7
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(118, 78)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(95, 20)
Me.Label5.TabIndex = 12
Me.Label5.Text = "Current Sales"
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Location = New System.Drawing.Point(254, 78)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(110, 20)
Me.Label6.TabIndex = 13
Me.Label6.Text = "Projected Sales"
'
'lblStraw
'
Me.lblStraw.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lblStraw.Location = New System.Drawing.Point(258, 105)
Me.lblStraw.Name = "lblStraw"
Me.lblStraw.Size = New System.Drawing.Size(100, 27)
Me.lblStraw.TabIndex = 14
Me.lblStraw.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'lblBlue
'
Me.lblBlue.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lblBlue.Location = New System.Drawing.Point(258, 154)
Me.lblBlue.Name = "lblBlue"
Me.lblBlue.Size = New System.Drawing.Size(100, 27)
Me.lblBlue.TabIndex = 15
Me.lblBlue.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'lblRasp
'
Me.lblRasp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lblRasp.Location = New System.Drawing.Point(258, 200)
Me.lblRasp.Name = "lblRasp"
Me.lblRasp.Size = New System.Drawing.Size(100, 27)
Me.lblRasp.TabIndex = 16
Me.lblRasp.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'btnCalc
'
Me.btnCalc.Location = New System.Drawing.Point(17, 261)
Me.btnCalc.Name = "btnCalc"
Me.btnCalc.Size = New System.Drawing.Size(81, 29)
Me.btnCalc.TabIndex = 8
Me.btnCalc.Text = "&Calculate"
Me.btnCalc.UseVisualStyleBackColor = True
'
'btnPrint
'
Me.btnPrint.Location = New System.Drawing.Point(110, 261)
Me.btnPrint.Name = "btnPrint"
Me.btnPrint.Size = New System.Drawing.Size(81, 29)
Me.btnPrint.TabIndex = 9
Me.btnPrint.Text = "&Print"
Me.btnPrint.UseVisualStyleBackColor = True
'
'btnClear
'
Me.btnClear.Location = New System.Drawing.Point(203, 261)
Me.btnClear.Name = "btnClear"
Me.btnClear.Size = New System.Drawing.Size(81, 29)
Me.btnClear.TabIndex = 10
Me.btnClear.Text = "C&lear"
Me.btnClear.UseVisualStyleBackColor = True
'
'btnExit
'
Me.btnExit.Location = New System.Drawing.Point(296, 261)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(81, 29)
Me.btnExit.TabIndex = 11
Me.btnExit.Text = "E&xit"
Me.btnExit.UseVisualStyleBackColor = True
'
'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
'
'frmMain
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8!, 20!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(392, 314)
Me.Controls.Add(Me.btnExit)
Me.Controls.Add(Me.btnClear)
Me.Controls.Add(Me.btnPrint)
Me.Controls.Add(Me.btnCalc)
Me.Controls.Add(Me.lblRasp)
Me.Controls.Add(Me.lblBlue)
Me.Controls.Add(Me.lblStraw)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.txtRasp)
Me.Controls.Add(Me.txtBlue)
Me.Controls.Add(Me.txtStraw)
Me.Controls.Add(Me.txtProjIncrease)
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 = "Cranston Berries"
Me.ResumeLayout(false)
Me.PerformLayout
End Sub
Friend WithEvents Label1 As Label
Friend WithEvents Label2 As Label
Friend WithEvents Label3 As Label
Friend WithEvents Label4 As Label
Friend WithEvents txtProjIncrease As TextBox
Friend WithEvents txtStraw As TextBox
Friend WithEvents txtBlue As TextBox
Friend WithEvents txtRasp As TextBox
Friend WithEvents Label5 As Label
Friend WithEvents Label6 As Label
Friend WithEvents lblStraw As Label
Friend WithEvents lblBlue As Label
Friend WithEvents lblRasp As Label
Friend WithEvents btnCalc As Button
Friend WithEvents btnPrint As Button
Friend WithEvents btnClear As Button
Friend WithEvents btnExit As Button
Friend WithEvents PrintForm1 As PowerPacks.Printing.PrintForm
End Class
- Run the program, by pressing the F5.
Screenshot of the output form
Screenshot of Calculate
Screenshot of Print Preview
Want to see more full solutions like this?
Chapter 3 Solutions
Programming with Microsoft Visual Basic 2015 (MindTap Course List)
- Draw a context diagram for this scenario: You are developing a new customer relationship Management system for the BEC store, which rents out movies to customers. Customers will provide comments on new products, and request rental extensions and new products, each of which will be stored into the system and used by the manager for purchasing movies, extra copies, etc. Each month, one employee of BEC will select their favorite movie pick of that week, which will be stored in. the system. The actual inventory information will be stored in the Entertainment Tracker system, and would be retrieved by this new system as and when necessary.arrow_forwardWrite a complete Java program named FindSumAndAverage that performs the following tasks in 2-D array: Main Method: a. The main() method asks the user to provide the dimension n for a square matrix. A square matrix has an equal number of rows and columns. b. The main() method receives the value of n and calls the matrixSetUp() method that creates a square matrix of size n and populates it randomly with integers between 1 and 9. c. The main method then calls another method named printMatrix() to display the matrix in a matrix format. d. The main method also calls a method named findSumAndAverage() which: • Receives the generated matrix as input. • Calculates the sum of all elements in the matrix. • Calculates the average value of the elements in the matrix. • Stores these values (sum and average) in a single-dimensional array and returns this array • e. The main method prints the sum and average based on the result returned from findSumAndAverage()). Enter the dimension n for the square…arrow_forwardThe partial sums remain the same no matter what indexing we done to s artial sum of each series onverges, * + s of each series to the series or show 12. (1)+(0)+(0)+(+1)+ 17, " (F) + (F) + (F)(F)(- 18. 19. 1 #20. (三)+(三)-(三)+(3) 20 (9)-(0)-(0)-- 10 +1 2.1+(男)+(男)+(罰)+(鄂 9 T29 x222-끝+1-23 + -.... Repeating Decimals 64 Express each of the numbers in Exercises 23-30 as the m integers. 23. 0.23 = 0.23 23 23... 24. 0.234 = 0.234 234 234. 25. 0.7 = 0.7777... 26. 0.d = 0.dddd... where d is a digit natio of own s converges or * 27. 0.06 = 0.06666.. 28. 1.4141.414 414 414... 29. 1.24123 = 1.24 123 123 123... 30. 3.142857 = 3.142857 142857. Using the ath-Term Test In Exercises 31-38, use the ath-Term Test for divergence to show that the series is divergent, or state that the test is inconclusive 8arrow_forward
- CPS 2231 Computer Programming Homework #3 Due Date: Posted on Canvas 1. Provide answers to the following Check Point Questions from our textbook (5 points): a. How do you define a class? How do you define a class in Eclipse? b. How do you declare an object's reference variable (Hint: object's reference variable is the name of that object)? c. How do you create an object? d. What are the differences between constructors and regular methods? e. Explain why we need classes and objects in Java programming. 2. Write the Account class. The UML diagram of the class is represented below (10 points): Account id: int = 0 - balance: double = 0 - annualInterestRate: double = 0.02 - dateCreated: java.util.Date + Account() + Account(id: int, balance: double) + getId(): int + setId(newId: int): void + getBalance(): double + setBalance(newBalance: double): void + getAnnualInterestRate(): double + setAnnualInterest Rate (newRate: double): void + toString(): String + getDataCreated(): java.util.Date +…arrow_forwardTHIS IS NOT A GRADING ASSIGNMENT: Please only do lab 2.2 (bottom part of the first picture) For that Lab 2.2 do: *Part 1 (do the CODE, that's super important I need it) *Part 2 *Part 3 I also attached Section 2.5.2 which is part of the step 1 so you can read what is it about. Thank you!arrow_forwardTHIS IS NOT A GRADING ASSIGNMENT: Please only do lab 2.2 (bottom part of the first picture) For that Lab 2.2 do: *Part 1 *Part 2 *Part 3 I also attached Section 2.5.2 which is part of the step 1 so you can read what is it about. Thank you!arrow_forward
- can you please give me: * the code (step 3) *the list file (step 5) *and answer step 6 Thank youarrow_forward# Find the error# Why will the following code not print out a list of contact namesphoneBook = {'Doe, Jane' : '843-000-0000' ,'Doe, John' : '843-111-1111' ,'Smith, Adam' : '843-222-2222' ,'Jobs, Steve' : '999-333-3333' ,}for contact in phoneBook.values():print(contact)arrow_forward# Find the error:# The following code creates an empty dictionary and attempts to add a record# Why will the following code not create a new dictionary entry as intended?phoneBook = {}phoneBook{'Jobs, Steve'} = '999-111-1111'arrow_forward
- Select all the possible polar representations of the vector that is obtained from rotating where by Zrot Ź x = 3e² T= 3п 8 Hint: Consider the negative angle that is equivalent to the positive angle of the rotated vector. 0arrow_forwardCharacter Analysis If you have downloaded the source code you will find a file named text.txt on the Chapter 08 folder. Write a program that reads the file's contents and determines the following: The number of uppercase letters in the file The number of lowercase letter in the file The number of digits in the file The number of whitespace characters in the filearrow_forwardWrite a program that reads the text file's contents and calculates and outputs the following in this order: • The number of words in the file • The number of lines in the file • The number of uppercase letters in the file • The number of lowercase letters in the file • The number of digits in the file • The number of letter H's in the file • The number of whitespace characters in the file NOTE: Your program should include at least one try-except error handling statement block. Your program should also validate any input that could cause your program to crash. I'm Henery The Eighth, I Am! Henery The Eighth, I Am, I am!I got married to the widow next door,She's been married seven times before.And ev'ryone was a Henery,She wouldn't have Willie or a Sam.I'm her eighth old man named Henery,Henery the Eighth, I Am!Second verse same as the first!I'm Henery The Eighth, I Am! Henery The Eighth, I Am, I am!I got married to the widow next door,She's been married seven times before.And…arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageCOMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L



