VisualBasicProject:The gooal of this project here is to let a user register for
ID: 3576814 • Letter: V
Question
VisualBasicProject:The gooal of this project here is to let a user register for one of the listed IT conferences and display an invoice.
Create two forms, one for choosing a conference and displaying its information, the other for choosing the registration details: how many guests you have, are you registering as a faculty or a student, etc.
1. Create a new project with two forms. Give the forms meaningful names (5 points)
2. Place the following controls on the form frmMenu (5x4=20 points) a. Menu Strip with two menu items. One has the text “Choose Conference” and three submenu options (“IACIS”, “ISECON”, and “iConference”). The other one has the text “Help” and does not have any sub-menu options.
b. Four labels with the text “Name:”, “Guests:”, “Conference:”, and “Total:”
c. Four text boxes with no text. Make sure that the text boxes are disabled.
d. Any Conference image.
3. Place the following controls on the form frmRegister (5x5=25 points):
a. Four labels with the text “Conference” and “Name”, and “Guests”. Add one more label next to the right from “Conference” and make sure it does not have any text. You will later display the name of the conference on this label.
b. A text box that will hold the name.
c. A combo box that will hold the number of guests.
d. Two radio buttons.
e. A button at the bottom with the text “Confirm”.
4. Add a module to your project. In the module, add the following contents (5+10=15 points):
a. Four public variables: a string variable Conference, a string variable GuestName, a decimal variable Price, and an integer variable Guests. Make all string variables equal to an empty string “” and the rest of the variables equal to 0.
b. Create a public function CalculatePrice that takes two variables by value, a string ConferenceName and an integer NumGuests. The function calculates and returns the total price of the conference registration based on the following rules: i. IACIS conference costs $495 ii. ISECON costes $395 iii. iConference costs $595 iv. If the participant brings guests, additional $50 is charged per guest v. If any other value of ConferenceName was passed (not IACIS, ISECON, or iConference), the function returns 0.
5. Add following functionality too tthe form frmMenu (5+10=15 points):
a. When the form loads, the values of GuestName, Guests, Conference, and Price are placed in the corresponding text boxes.
b. When each of the Conference sub-menus is clicked, the following events happen. i. The value of Conference becomes equal to the option that was clicked (“IACIS”, “ISECON”, or “iConference”) ii. The current form closes (hint: use Me.Close() command) and the Registration form opens.
6. Add the following functionality to the form frmRegister (5+5+10=20 points):
a. When the form opens, the combo box that has the number of guests is populated with the values 0, 1, … 4. Use the loop to fill in the numbers.
b. When the form opens, the text of the label next to “Conference” becomes equal to the variable Conference.
c. When the uuser clicks Confirm button, the following events happen: i. Tyhe value oof GuestName becomes equal to the text in the text box that holds name ii. The value of Guests becomes equal to the selected text in the combo box
iii. If Facultty radiio button is selected, the value of Price becomes equal to the value of the function Calculate price, called with the variables Conference and Guests iv. If Student radio button is selected, the value of Price becomes equal to the value of the function Calculate price, called with the variables Conference and Guests, minus $200 (a student discount rate). v. Current form hides and the Menu form shoows.
Explanation / Answer
Imports System.Data Imports System.Data.SqlClient Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim connetionString As String = Nothing Dim connection As SqlConnection Dim command As SqlCommand Dim adapter As New SqlDataAdapter() Dim ds As New DataSet() Dim i As Integer = 0 Dim sql As String = Nothing connetionString = "Data Source=ServerName;Initial Catalog=databasename;User ID=userid;Password=yourpassword" sql = "select au_id,au_lname from authors" connection = New SqlConnection(connetionString) Try connection.Open() command = New SqlCommand(sql, connection) adapter.SelectCommand = command adapter.Fill(ds) adapter.Dispose() command.Dispose() connection.Close() ComboBox1.DataSource = ds.Tables(0) ComboBox1.ValueMember = "au_id" ComboBox1.DisplayMember = "au_lname" Catch ex As Exception MessageBox.Show("Can not open connection ! ") End Try End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox(ComboBox1.Text + " -- " + ComboBox1.SelectedValue) End Sub End Class
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.