In: Computer Science
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 Also include identifying labels with text "Department Contact'' and "Telephone Number". Be sure to include a button for Exit. Include a label at the bottom of the form that holds your name. Department Department Telephone Contact Custom relations Tricia Mills 500-1111• Marketing Michelle Rigner 500-2222 Order Processing Kenna DeVoes 500-3333 Shipping Eric Martin 500-4444
Answer)
I take one form in Visual Basic after opening the project. Then I take four buttons for four departments, and one button for exit. I Change the text of every button to display according to their departments and exit for exit button. I marked in the code which buuton is used for which deparment. The I take five label, 2 for displaying the Department Contact and Telephone Number. And other 2 for display Department Contact Name and Telephone Number when the related button is clicked. And the last label is at the bottom of the form to display the name. In all the buttons button_click event is trapped to display the name and number in the label. Application.exit is used to exit from the form.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
'Button1 is used to display Customer Relations contact and
telephone number
Label2.Text = "Tricia Mills"
Label4.Text = "500-1111"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
'Button2 is used to display Marketting contact and telephone
number
Label2.Text = "Michelle Rigner"
Label4.Text = "500-2222"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
'Button1 is used to display order processing contact and telephone
number
Label2.Text = "Kenna DeVoes"
Label4.Text = "500-3333"
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button4.Click
'Button4 is used to display Shipping contact and telephone
number
Label2.Text = "Eric Martin"
Label4.Text = "500-4444"
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button5.Click
'Button5 is used to exit from the application
Application.Exit()
End Sub
End Class
Screenshot of the code output after adding the buttons and labels in execution mode.