I am new to VB. I use Visual Studio 2010. I got most of my rental program to work, but I am having trouble with the easy part. The First Name and Last Name are supposed to combine to the FullName. I know I have to use the assigning textbox text to the the variables. I haven't had much luck to to that.
'Project: Very Very Snowboards
'Date: 10/22/2011
'Programmer: X
'Description: This program inputs sales information for snowboard rental and snowboard rental with boots. It gives output the total snowboards rented,
' total snowboards with boots rented, total charges, and average total charges per customer.
Option Strict On
Public Class VeryVerySnowBoards
'Declare the variables and constants in module-level.
Private FirstNameTextBoxString As String
Private LastNameTextBoxString As String
Private FirstNameString As String
Private LastNameString As String
Private FullNameTextBoxString As String
Private FullNameString As String
Private DriversLicenseTextBoxString As String
Private DriversLicenseString As String
Private NumberofSnowboardsRentedInteger As Integer
Private NumberOfSnowboardsWithBootsRentedInteger As Integer
Private TotalSnowboardsRentedString As String
Private TotalSnowboardsWithBootsRentedString As String
Private TotalChargesTextBoxDecimal As Decimal
Private TotalCustomersTextBoxInteger As Integer
Private AverageChargePerCustomerTextBoxDecimal As Decimal
Const RENT_COST_PER_BOARD_Decimal As Decimal = 20D
Const RENT_COST_PER_BOARD_WITH_BOOTS_Decimal As Decimal = 30D
Private Sub FirstName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FirstNameTextBox.TextChanged
'Declare first name.
FirstNameTextBoxString = FirstNameTextBox.Text
End Sub
Private Sub LastName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LastNameTextBox.TextChanged
'Declare last name.
LastNameTextBoxString = LastNameTextBox.Text
End Sub
Private Sub FullNameTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FullNameTextBox.TextChanged
FullNameTextBoxString = FirstNameTextBoxString & "" & LastNameTextBoxString
End Sub
Private Sub DriversLicense_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DriversLicense.TextChanged
'Declare driver's license.
DriversLicenseTextBox.Text = DriversLicenseString
End Sub
Private Sub CalculateOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateOrder.Click
'Calculate transaction total while providing the amount of transaction totals to daily totals.
'Calculate the values of the rentals.
'Declare on the DIM level.
Dim TotalSnowboardsRentedTextBoxInteger As Integer
Dim TotalSnowBoardsWithBootsRentedTextBoxInteger As Integer
Dim NumberOfSnowboardsRentedInteger As Integer
Dim NumberOfSnowboardsWithBootsRentedInteger As Integer
Dim NumberOfSnowboardsRentedDecimal As Decimal
Dim NumberOfSnowboardsWithBootsRentedDecimal As Decimal
Dim TotalChargesTextBoxDecimal As Decimal
Dim AverageChargePerCustomerTextBoxDecimal As Decimal
Dim TotalCustomersTextBoxInteger As Integer
Dim CostOfRentalTextBoxDecimal As Decimal
Try
'Convert snowboards only as a numeric variable.
NumberOfSnowboardsRentedInteger = Integer.Parse(NumberOfSnowboardsRentedTextBox.Text)
Try
'Convert snowboards with boots as a numeric variable.
NumberOfSnowboardsWithBootsRentedInteger = Integer.Parse(NumberOfSnowboardsWithBootsRentedTextBox.Text)
'Calculate individual values for Snowboards only and Snowboards with Boots.
NumberOfSnowboardsRentedDecimal = NumberOfSnowboardsRentedInteger * RENT_COST_PER_BOARD_Decimal
NumberOfSnowboardsWithBootsRentedDecimal = NumberOfSnowboardsWithBootsRentedInteger * RENT_COST_PER_BOARD_WITH_BOOTS_Decimal
CostOfRentalTextBoxDecimal = NumberOfSnowboardsRentedDecimal + NumberOfSnowboardsWithBootsRentedDecimal
'Format and display for customer charges.
NumberOfSnowboardsRentedTextBox.Text = NumberOfSnowboardsRentedInteger.ToString
NumberOfSnowboardsWithBootsRentedTextBox.Text = NumberOfSnowboardsWithBootsRentedInteger.ToString
TotalChargesTextBox.Text = TotalChargesTextBoxDecimal.ToString("C")
CostOfRentalTextBox.Text = CostOfRentalTextBoxDecimal.ToString("C")
'Add to Daily Total.
TotalSnowboardsRentedTextBoxInteger += NumberOfSnowboardsRentedInteger
TotalSnowBoardsWithBootsRentedTextBoxInteger += NumberOfSnowboardsWithBootsRentedInteger
TotalCustomersTextBoxInteger += 1
TotalChargesTextBoxDecimal += CostOfRentalTextBoxDecimal
AverageChargePerCustomerTextBoxDecimal = TotalChargesTextBoxDecimal / TotalCustomersTextBoxInteger
'Display as Currency and daily totals.
TotalSnowboardsRentedTextBox.Text = TotalSnowboardsRentedTextBoxInteger.ToString
TotalSnowboardsWithBootsRentedTextBox.Text = TotalSnowBoardsWithBootsRentedTextBoxInteger.ToString
TotalCustomersTextBox.Text = TotalCustomersTextBoxInteger.ToString
TotalChargesTextBox.Text = TotalChargesTextBoxDecimal.ToString("C")
AverageChargePerCustomerTextBox.Text = AverageChargePerCustomerTextBoxDecimal.ToString("C")
Catch SnowboardsWithBootsException As FormatException
'Handle the number of boots.
MessageBox.Show("Please Input the number of Snowboards rented with boots.",
"Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
With NumberOfSnowboardsWithBootsRentedTextBox
.Focus()
.SelectAll()
End With
End Try
Catch SnowboardsException As FormatException
'Handle the number of snowboards.
MessageBox.Show("Please Input Number of Snowboards rented.",
"Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
With NumberOfSnowboardsRentedTextBox
.Focus()
.SelectAll()
End With
Catch AnException As Exception
MessageBox.Show("Error:" & AnException.Message)
End Try
End Sub
Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
'Clears all data from current transaction.
NumberOfSnowboardsRentedTextBox.Clear()
NumberOfSnowboardsWithBootsRentedTextBox.Clear()
DriversLicense.Clear()
FirstNameTextBox.Clear()
LastNameTextBox.Clear()
End Sub
Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
'Print the form.
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()
End Sub
Private Sub ClearAllButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearAllButton.Click
'Clear all daily amounts from the form.
TotalSnowboardsRentedTextBox.Clear()
TotalSnowboardsWithBootsRentedTextBox.Clear()
TotalChargesTextBox.Clear()
TotalCustomersTextBox.Clear()
AverageChargePerCustomerTextBox.Clear()
FullNameTextBox.Clear()
DriversLicenseTextBox.Clear()
CostOfRentalTextBox.Clear()
With TotalCustomersTextBox
.Clear()
.Focus()
End With
TotalSnowboardsRentedInteger = 0
TotalSnowboardsWithBootsRentedInteger = 0
TotalCustomersInteger = 0
TotalChargesDecimal = 0
AverageChargePerCustomerDecimal = 0
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
'Exit the project.
Me.Close()
End Sub
End Class