Question

In: Computer Science

NOTE: This is done using Visual Basic. Create an application named You Do It 2. Add...

NOTE: This is done using Visual Basic.

Create an application named You Do It 2. Add a text box, a label, and a button to the form. Enter the following three Option statements above the Public Class clause in the Code Editor window: Option Explicit On, Option Strict Off, and Option Infer Off. In the button’s Click event procedure, declare a Double variable named dblNum. Use an assignment statement to assign the contents of the text box to the Double variable. Then, use an assignment statement to assign the contents of the Double variable to the label. Save the solution and then start and test the application. Stop the application. Finally, change the Option Strict Off statement to Option Strict On and then use what you learned in this Focus lesson to make the necessary modifications to the code. Save the solution and then start and test the application. Close the solution.

Solutions

Expert Solution

Windows Forms Application project in C# is created using visual studio with name "You_Do_It".Below is the details.

Form1.vb[Design] :

Form1.vb :

'three Option statements
Option Explicit On
Option Strict Off
Option Infer Off
Public Class Form1
'display button click
Private Sub btnContents_Click(sender As Object, e As EventArgs) Handles btnContents.Click
'declaring variable of type double that is dblNum
Dim dblNum As Double
'taking text entered by user and assign to the variable dblNum
dblNum = Double.Parse(txtContents.Text)
'display variable’s contents in the label
lblDisplayContents.Text = dblNum
End Sub
End Class
=======================================

Output :

NOTE :

  • when Option Strict On then implicit conversion from double to String is not possible.
  • Need to explicitly type cast dblNum to string.
  • Below is the code

'three Option statements
Option Explicit On
Option Strict On
Option Infer Off
Public Class Form1
'display button click
Private Sub btnContents_Click(sender As Object, e As EventArgs) Handles btnContents.Click
'declaring variable of type double that is dblNum
Dim dblNum As Double
'taking text entered by user and assign to the variable dblNum
dblNum = Double.Parse(txtContents.Text)
'display variable’s contents in the label
'need to explicitly typecast from double to string
lblDisplayContents.Text = dblNum.ToString()
End Sub
End Class


Related Solutions

NOTE: This is done using Visual Basic. Create an application named You Do It 1. Add...
NOTE: This is done using Visual Basic. Create an application named You Do It 1. Add a text box, a label, and a button to the form. The button’s Click event procedure should store the contents of the text box in a Double variable named dblCost. It then should display the variable’s contents in the label. Enter the three Option statements above the Public Class clause in the Code Editor window, and then code the procedure. Save the solution and...
Program on Visual Basic, VBA Create an application that lets the user enter a number of...
Program on Visual Basic, VBA Create an application that lets the user enter a number of seconds and produces output according to the following criteria: There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds. There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or...
Windows Forms application using Visual Basic: Create a class called Character that a role-playing game might...
Windows Forms application using Visual Basic: Create a class called Character that a role-playing game might use to represent a character within the game. A character should include six stats as instance variables – strength, dexterity, constitution, intelligence, wisdom and charisma (all types are int). Your class should have a constructor that initializes these six instance variables. Provide Properties with an appropriate set and get block for each instance variable. In addition, provide a method named getStatsTotal that calculates the...
windows forms Application using Visual Basic use visual basic 2012 Part 1: Programming – Income Tax...
windows forms Application using Visual Basic use visual basic 2012 Part 1: Programming – Income Tax Application 1.1 Problem Statement Due to upcoming end of financial year, you are being called in to write a program which will read in a file and produce reports as outlined. Inputs: The input file called IncomeRecord.txt contains a list of Annual income records of employees in a firm. Each record is on a single line and the fields are separated by spaces. The...
Visual Basic Your first job is to create a visual basic project that will display the...
Visual Basic Your first job is to create a visual basic project that will display the name and telephone number for the contact person for the customer relations, marketing, order processing, and shipping departments. Include a button for each department. When the user clicks on the button for a department the program(in code for specific button will display the name and telephone number for the contact person in two labels. The same two labels will be used for each department...
C# Programming language!!! Using visual studios if possible!! PrimeHealth Suite You will create an application that...
C# Programming language!!! Using visual studios if possible!! PrimeHealth Suite You will create an application that serves as a healthcare billing management system. This application is a multiform project (Chapter 9) with three buttons. The "All Accounts" button allows the user to see all the account information for each patient which is stored in an array of class type objects (Chapter 9, section 9.4).The "Charge Service" button calls the Debit method which charges the selected service to the patient's account...
Must be in Visual C# using windows forms : Create an application that opens a specified...
Must be in Visual C# using windows forms : Create an application that opens a specified text file and then displays a list of all the unique words found in the file. Hint: Use a LINQ method to remove all duplicate words.
Create an empty Web Site application named Bakery. Add a new Web page named Default.aspx to the application. Change the DOCUMENT object's Title property to Meyer's.
In Visual BasicCreate an empty Web Site application named Bakery. Add a new Web page named Default.aspx to the application. Change the DOCUMENT object's Title property to Meyer's. The application should allow the user to enter two items: the number of doughnuts ordered and the number of muffins ordered. The application should should display the total number of items ordered and the total sales amount, inlcuding a 5% sales tax. A doughnut costs .50; a muffin costs .75. Save the...
Make a Console application Language should be Visual Basic In this assignment, you will be calculating...
Make a Console application Language should be Visual Basic In this assignment, you will be calculating the two parts for each month. you calculate the interest to pay each month and principal you pay every month. The interest you pay every month = loan * monthlyInterest The principal you pay every month = monthlyMortgage -  interest you pay every month ' what is my remaining loan loan = loan - principal you pay every month Problem 1 : Using While Loop,...
Use Visual Basic Language In this assignment you will need to create a program that will...
Use Visual Basic Language In this assignment you will need to create a program that will have both a “for statement” and an “if statement”. Your program will read 2 numbers from the input screen and it will determine which is the larger of the 2 numbers. It will do this 10 times. It will also keep track of both the largest and smallest numbers throughout the entire 10 times through the loop. An example of the program would be...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT