Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Open Visual Basic and create a new Project. Select Windows Form New Project window. You will save this project in your CS 3 folder and

  1. Open Visual Basic and create a new Project. Select Windows Form New Project window. You will save this project in your CS 3 folder and name it as: yourlastname-firstname-SelectionVBProgram. See below for more information on how to create this project
  2. Create a form with two labels, one textbox and one button, similar to sample form below. We use textbox control to receive input.
  3. Here are the properties of the form and each control:
  4. Form: change the title of the form to: Selection Homework your name
  5. Label1, Text: Enter a value for IntNumber; Name: lblIntNumber
  6. Label2, Text: Display IntNumber; Name: lblResult ; BorderStyle: Fixed 3D; AutoSize: False
  7. Textbox, Name: txtEnterIntNumber
  8. Button, Text: Compute; Name: btnCompute

image text in transcribed

9. Double-click on Compute Button; declare a variable called intNumber as Integer, then type the below code. Run the program and test it for intNumber values of 50, 500 and 1000. For each test the result should be: 100, 500, and 3000 respectively.

If intNumber

intNumber = intNumber * 2

ElseIf intNumber> 500 Then

intNumber = intNumber * 3

End If

  1. To receive credit for this assignment, create a pdf file and name it Yourlastname-HW9.pdf. Your pdf file should contain the screenshots of all the execution steps (similar to last HW). Submit the pdf file in Assignment 9. Only ONE file, please.

To create a new project in VB, open Visual Studio > From File > New > Project, then you will see the following window:

image text in transcribed

Expand Visual Basic group, choose Windows Classic Desktop, choose Windows Forms App (.NET Framework).

Type project name: yourlastname-firstname-SelectionVBProgram in Name box, click on Browse button, locate CS folder and just select it do not double-click on it.Then you will see the following window, click on OK to continue this creates a folder with your project name and inside of this folder there is one folder and a file with SLN extension.

image text in transcribed

Here is the folder listing:

image text in transcribed

Upon clicking on New Project window, you will be placed in VB editor window, see below:

image text in transcribed

From here on, click on View menu to activate Toolbox menu, expand Common Buttons, Then add two Label controls, one TextBox and one Button controls on the form. Follow the instructions to name each control and add necessary text properties for each control. See below:

image text in transcribed

Then double-click on the Button which now should read computer to see the VB coding area, Form1.vb

image text in transcribed

To start the coding, first you need to declare a variable an integer:

Dim intNumber As Integer

Then you store the value from TextBox into intNumber variable, so here is your code:

intNumber = txtEnterIntNumber.Text

After these two lines you type the selection structure listed on the first page of assignment:

If intNumber

intNumber = intNumber * 2

ElseIf intNumber> 500 Then

intNumber = intNumber * 3

End If

Finally, you need to display the result in the label control, so you need the following code to display the result:

lblResult.text = intNumber

Test your program and enter different values to make sure the result displays correctly.

Selection Homework -Student Name Label 1 for IntNumber TextBox Label 2 Display IntNumber Compute Button New Project D Recent Installed NET Framework 4.6.1 Sort by: Default Search (Ctrl+E) F' WPF App (NET Framework) Type: Visual Basic Visual Basic Visual C# A project for creating an application with a Windows user interface VB Visual Basic Windows Forms App (NET Framework) Visual Basic Windows Universal Windows Classic Desktop Web NET Core NET Standard Cloud Test WCF VB CA Console App (NET Framework) Visual Basic VB Class Library CNET Framework) Visual Basic VB Windows Service (NET Framework) Visual Basic VB Empty Project (NET Framework) Visual Basic VB D Visual C++ SQL Server DJavaScript TypeScript WPF Browser App (NET Framework WPF User Control Library (NET Framework) WPF Custom Control Library (NET Framework) Windows Forms Control Library (NET Framework) Visual Basic VB Visual Basic VB b Other Project Types Visual Basic VB .J D Online Visual Basic Not finding what you are looking for? Open Visual Studio Installer Name: Location: Solution name: WindowsApp1 C:Users\bolandhemat_faribalsource epos WindowsApp1 Browse... Create directory for solution Add to Source Control OK Cancel New Project D Recent NET Framework 4.6.1 Sort by: Default Search (Ctrl+E) Installed Type: Visual Basic WPF App (NET Framework) Visual Basic Visual C# A project for creating an application with a Windows user interface VB Windows Forms App (NET Framework) Console App (NET Framework) Class Library (NET Framework) Windows Service (NET Framework) Visual Basic Visual Basic Windows Universal Windows Classic Desktop Web NET Core NET Standard Cloud Test WCF VB Visual Basic VB Visual Basic VB Visual Basic VB Empty Project (NET Framework) Visual Basic VB D Visual C++ SQL Server JavaScript D TypeScript Visual Basic WPF Browser App (NET Framework) WPF User Control Library (NET Framework) Ctom Control Library CNET Framework) Windows Forms Control Library (NET Framework) VB Visual Basic VB b Other Project Types Visual Basic D Online VB Visual Basic Not finding what you are looking for? Open Visual Studio Installer Name: Location: Solution name: ourlastname-firstname-SelectionVBProgra C:\Users) bolandhemat_fariba\ DesktoplCS3_Sp18_1701 CS3 yourlastname-firstname-SelectionVBProgram Browse... Create directory for solution Add to Source Control OK Cancel Name Date modified Type yourlastname-firstname-SelectionVBProgram yourlastname-firstname-SelectionVBProgram.sln 4/29/2018 10:11 PM Visual Studio Solu.. 4/29/2018 10:24 PM File folder yourlastname-firstname-SelectionVBProgram - Microsoft Visual Studio Quick Launch (Ctri+0) File Edit View Project Build Debug Team Format Tools Test Analyze Window Help Sign in Form1.vb [Design] H X Solution Explorer : Form 1 Search Solution Explorer (Ctrl+) Solution yourlastname-firstname-SelectionVBProgram.- VB yourlastname-firstname-SelectionVBProgram My Project Solution Explorer Team Explorer Properties Form1 System.Windows.Forms.Form Location Locked MainMenuStrip MaximizeBox 0, 0 False (none) MaximumSize 0, 0 MinimizeBox MinimumSize 0, 0 100% 0, 0, 0, 0 Opacity Padding RightToLeft RightToLeftLayout Showlcon ShowlnTaskbar False Output Show output from: Size 300, 300 Auto WindowsDefaultLocation SizeGripStyle StartPosition la Text Form 1 Text The text associated with the control Error List Output yourlastname-firstname-SelectionVBProgram - Microsoft Visual Studio Quick Launch (Ctrl+Q) File Edit View Project Build Debug Team Format Tools Test Analyze Window Help Debug Any CPU Sign in Form1.vb* Form 1.vb [Design]* Solution Explorer Form1 Search Solution Explorer (Ctrl+) Enter a value for IntNumber Solution yourlastname-firstname-SelectionVBProgram VB yourlastname-firstname-SelectionVBProgram My Project Display IntNumber Solution Explorer Team Explorer Properties Form1 System.Windows.Forms.Form Compute Location Locked MainMenuStrip MaximizeBox False (none) True MaximumSize MinimizeBox E MinimumSize True 0, 0 100% 0, 0, 0, 0 Opacity Padding RightToLeft RightToLeftLayout False True True 437, 301 Auto WindowsDefaultLocation Output Show output from: ShowlnTaskbar Size SizeGripStyle StartPosition Tag yourlastname-firstname-SelectionVBProgram - Microsoft Visual Studio Quick Launch (Ctri+0) File Edit View Project Build Debug Team Tools Test Analyze Window Help Debug Any CPU Form1.vb* x Form1.vb [Design]* Solution Explorer Volastname-firstname-SelectionVBProgrbtnCompute Click 0 references Search Solution Explorer (Ctrl+) 2 Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles t Solution 'yourlastname-firstname-SelectionV VB yourlastname-firstname-SelectionVBPr End Sub 4 5 My Project End Class Solution Explorer Team Explorer Properties 121 %

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions