I'm new to VB and am writing a basic revenue calculator for class and for some reason I can't get it to display the computed values in the label fields when I run the form. I've been through the example code provide to me, my textbook, google (how I found DaniWeb), and I've been over the code probably 50 times and the problem just isn't jumping out at me and it doesn't generate any errors or trigger the try catch, so I'm asking for fresh eye. Please don't just correct the code, I'm not looking for someone to do my homework just a nudge in the right direction from someone with a little more experience so I can learn for myself. Now for the Code:

Private Sub btnCalcRevenue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

        'Declare Variables
        Dim intClassA As Integer
        Dim intClassB As Integer
        Dim intClassC As Integer
        Dim sngRevenueA As Single
        Dim sngRevenueB As Single
        Dim sngRevenueC As Single
        Dim sngTotalRevenue As Single
        Const int_CLASS_A_PRICE As Integer = 15
        Const int_CLASS_B_PRICE As Integer = 12
        Const int_CLASS_C_PRICE As Integer = 9

        Try

            'Get Values for number of tickets sold in each class from textboxes
            intClassA = CInt(txtClassA.Text)
            intClassB = CInt(txtClassB.Text)
            intClassC = CInt(txtClassC.Text)

            'Calculate the Revenue for each class
            sngRevenueA = CSng(intClassA * int_CLASS_A_PRICE)
            sngRevenueB = CSng(intClassB * int_CLASS_B_PRICE)
            sngRevenueC = CSng(intClassC * int_CLASS_C_PRICE)

            'Calculate  the total Revenue
            sngTotalRevenue = sngRevenueA + sngRevenueB + sngRevenueC

            'Display the Results
            lblRevenueA.Text = sngRevenueA.ToString("c")
            lblRevenueB.Text = sngRevenueB.ToString("c")
            lblRevenueC.Text = sngRevenueC.ToString("c")
            lblTotalRevenue.Text = sngTotalRevenue.ToString("c")

        Catch ex As Exception

        End Try

    End Sub

Apparently I just needed to look at it 51 times b/c I just realized I had somehow deleted a piece of code that Visual Studio generates when double clicking the button to write the code. Here is the piece that was missing from line 1

Handles btnCalcRevenue.Click
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.