Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Visual Basic help please. My code so far: Public Class Form1 Dim conversionTable(,) As String = { {Miles to kilometers, Miles, Kilometers, 1.6093}, {Kilometers to

Visual Basic help please.

image text in transcribed

My code so far:

Public Class Form1 Dim conversionTable(,) As String = { {"Miles to kilometers", "Miles", "Kilometers", "1.6093"}, {"Kilometers to miles", "Kilometers", "Miles", "0.6214"}, {"Feet to meters", "Feet", "Meters", "0.3048"}, {"Meters to feet", "Meters", "Feet", "3.2808"}, {"Inches to centimeters", "Inches", "Centimeters", "2.54"}, {"Centimeters to inches", "Centimeters", "Inches", "0.3937"}}

Public Function IsPresent(ByVal textbox As TextBox, ByVal name As String) _ As Boolean If textbox.Text = "" Then MessageBox.Show(name & " is a required field.", "Entry Error") textbox.Select() Return False Else Return True End If End Function

Public Function IsDecimal(ByVal textbox As TextBox, ByVal name As String) _ As Boolean Dim number As Decimal = 0 If Decimal.TryParse(textbox.Text, number) Then Return True Else MessageBox.Show(name & " must be a decimal value.", "Entry Error") textbox.Select() textbox.SelectAll() Return False End If End Function

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub

End Class

Thank you!

Exercise 10-1 Convert lengths In this exercise, you'll add code to a form that converts the value the user enters based on the selected conversion type Conversion: Meters to feet Meters 500 Feet 1.640 40 Calculate Ext The application should handle the following conversions From Miles Kilometers Miles Feet Meters Inches Centimeters Inches Conversion 1 mile 1.6093 kilometers 1 kilometer0.6214 miles 1 foot0.3048 meters 1 meter 3.2808 feet 1 inch 2,54 centimeters 1 centimeter 0.3937 inches To Kilometers Meters Feet Centimeters Open the Conversions project. Display the code for the form, and notice the rectangular array whose rows contain the value to be displayed in the combo box, the text for the labels that identify the two text boxes, and the multiplier for the conversion as shown above. Note: An array is similar to a string with an index beginning with 0 (zero) 1. Set the DropDownStyle property of the combo box so the user must select an item from the list. 2. Add code to load the combo box with the first element in each row of the rectangular array, and display the first item in the combo box when the form is loaded Add code to change the labels for the text boxes, clear the calculated length, and move the focus to the entry text box when the user selects a different item from the combo 3. 4. x. 5. Test the application to be sure the conversions are displayed in the combo box, the first conversion is selected by default, and the labels change appropriately when a different conversion is selected 6. Add code to calculate and display the converted length when the user dlicks the Calculate button. To calculate the length, you can get the index for the selected conversion and then use that index to get the multiplier from the array. Test the application to be sure this works c Add code to check that the user enters a valid decimal value for the length. Then, test the application one more time to be sure the validation works correctly onr 7

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

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions