Explanation of Solution
Program
Public Class frmMain
'declaring variables of string type
Dim capital As String
Dim state As String
'display button click
Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click
'display state and capital on label
lblCapital.Text = String.Format(" State : {0} , Capital is : {1}", state, capital)
'change forecolor of label
lblCapital.ForeColor = Color.Maroon
'change backcolor of label
lblCapital.BackColor = Color.Yellow
End Sub
'Exit button click
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
'when this button clicked close the application
Application.Exit()
End Sub
'checkChanged event for radio button texas
Private Sub rbtTaxas_CheckedChanged(sender As Object, e As EventArgs) Handles rbtTaxas.CheckedChanged
'clear text on label
lblCapital.Text = ""
'if radio button texas is checked
If rbtTaxas.Checked = True Then
'set the value of variable capital
capital = "Austin"
'set the state name as radio button text
state = rbtTaxas.Text
End If
End Sub
'checkChanged event for radio button washington
Private Sub rbtWashington_CheckedChanged(sender As Object, e As EventArgs) Handles rbtWashington.CheckedChanged
'clear text on label
lblCapital.Text = ""
'if radio button washington is checked
If rbtWashington.Checked = True Then
'set the value of variable capital
capital = "Olympia"
'set the state name as radio button text
state = rbtWashington...
Trending nowThis is a popular solution!
Chapter 4 Solutions
Programming with Microsoft Visual Basic 2017
- Which property is used to give a form file a more meaningful name? File File Name Form Name Namearrow_forwardInclude a header that is Your Name, Math Tables Include an "Addition Table" button Include a "Multiplication Table" button Both tables should use the same window for the display of their information In the secondary window, include the following: A comment in the code that includes the assignment name, your name, and the date Use the file name "MathTableDisplay.htm" for the secondary window file The header for the secondary window is "Addition Table" when the addition table is displayed The header for the secondary window is "Multiplication Table" when the multiplication table is displayed Example web page displays and code for the addition table are included belowarrow_forwardInput data: Feet: User enters a number for feet Period: User enters a number for inches Instructions: Create a new project and name it as yourlastname-firstname-Assignment5. Save this project in VB folder you created earlier. Change form’s title to: Your full name – Assignment 5 - Conversion. Form contains four Labels, two TextBoxes, and three Button controls. Use labels to identify Feet, Inches and Meters. See below Form Layout with Controls for more details. Note: You will use the same control Names shown below. - Input variables: Feet (Single) - TextBox, txtFeet Inches (Single) - TextBox, txtInches - Output variables: Meters (Single) -Label, lblMeters To convert feet and inches to meters, use this formula: (feet * 12 + inches) * 0.0254. 0.0254 is a constant value to convert English system to Metric. Make sure to declare a Constant for this literal number. You construct a Function for this conversion. It will be placed after End Sub for btnConvert_Click. Start…arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning