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

See if this helps.

Private Sub FirstName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FirstNameTextBox.TextChanged
            FirstNameTextBoxString = FirstNameTextBox.Text
			setFullName()
        End Sub

        Private Sub LastName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LastNameTextBox.TextChanged
            LastNameTextBoxString = LastNameTextBox.Text
			setFullName()
        End Sub
		
		Private Sub setFullName()
		FullNameTextBoxString = FirstNameTextBoxString & " " & LastNameTextBoxString
		FullNameTextBox.Text = FullNameTextBoxString
		End Sub

codeorder, that actually worked but when I input the first and last names they go straight to the Full Name textbox on the bottom. But when you type it in, you see the full name in 'realtime.' I need to see the full name when you press Calculate Order button.

I also can't get the driver's license part to work. should i attach a screenshot?

.Remove: setFullName() from the 2 _TextChanged events and only add it to your "btnCalculateOrder".Click.

>>...can't get the driver's license part to work...
.and the part you can't get to work is?

Edited 5 Years Ago by codeorder: n/a

the drivers license doesn't appear in the Drives License TextBox on the bottom after you input it.

I have a feeling that line.66 in your code should be: DriversLicenseString = DriversLicense.Text

Edited 5 Years Ago by codeorder: n/a

>>I tried it, but it didn't work.
Sucks for you?:D

Just wondering; how is DriversLicenseString 's value displayed in your TextBox?

>>the drivers license doesn't appear in the Drives License TextBox on the bottom after you input it.

Drives License TextBox.Text = DriversLicenseString

That should be located somewhere w/in your code, if you want it to display anything.

I tried to put that under the Calculate Order button properties with no success yet.

I fiddled around for a bit with the code. So i input the drivers license in the top box. Now when I hit the calculate button, I get a "0" in the drivers license summary box.

Keep that in the btnCalculateOrder.Click event and replace this event entirely.

Private Sub DriversLicense_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DriversLicense.TextChanged
            DriversLicenseString = DriversLicense.Text
        End Sub

Saw that you just posted, sucks for you.:D
.At least you got a .Value added to your TextBox so far. Before you post again, My.Suggestion = "keep fiddleling" .

Edited 5 Years Ago by codeorder: iCODE

Just reinstalled my o.s., flied w/out a vb.radar for a few hours:D, though glad that your current programming issue is "Solved" AndAlso glad that I was able to still provide.support.:)

Edited 5 Years Ago by codeorder: n/a

This question has already been answered. Start a new discussion instead.