The following table shows lists of six states and their official abbreviations.StateAbbreviationsVirginiaVANorth CarolinaNCTexasTXGeorgiaGAAlabamaALFloridaFLCreate an application that allows the user to select a state and then displays thatstate’s official abbreviation. The form should have seven buttons, one for each state and an Exit button. The application should perform the following actions:When the user clicks on Virginia, the application should display VA in a Message Box.When the user clicks on North Carolina, the application should display NC in a StatusStrip Control.When the user clicks on Texas, the application should display TX in a Label Control.When the user clicks on Georgia, the application should display GAin a StatusStrip Control.When the user clicks on Alabama, the application should display AL in a Message Box.When the user clicks on Florida, the application should display FL in a Label Control.When the user clicks on Exit, the application should close.
Using Visual Basic
Answer)
The code. ' is used for comments.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
'display in the message box
MsgBox("VA")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
'StatusStrip1 by default it is false
StatusStrip1.Visible = True
ToolStripStatusLabel1.Text = "NC"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
'displayed in a label
Label1.Text = "TX"
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button4.Click
StatusStrip1.Visible = True
ToolStripStatusLabel1.Text = "GA"
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button5.Click
MsgBox("AL")
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button6.Click
Label2.Text = "FL"
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button7.Click
'button7 is used for exit
'close the current form for exit
'me is used to refre the current form
Me.Close()
End Sub
End Class
Screenshot
Get Answers For Free
Most questions answered within 1 hours.