Start New Discussion within our Software Development Community

ok so i'm new to vb.
what is wrong with this code at line 28:

Public Class Form1

Const DISCOUNT_RATE As Double = 0.1
Const RENTAL_RATE As Double = 1.8

Dim totSales As Integer
Dim totIncome As Double


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



End Sub

Private Sub rentalInfoGroupBox_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rentalInfoGroupBox.Enter

End Sub

Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click

    Dim custID As Integer
    Dim noMovies As Integer
    Dim price As Double
    Dim discount As Double
    Dim total As Double

    custID = Integer.Parse(Me.custIDTextBox.Text)
    noMovies = Integer.Parse(Me.numMoviesTextBox.Text)
    price = noMovies * RENTAL_RATE
    discount = price * DISCOUNT_RATE
    total = price - discount

    totSales += 1
    totIncome += total

    priceTextBox.Text = price
    discountTextBox.Text = discount
    totalDueTextBox.Text = total

    totalSalesTextBox.Text = totSales
    totalIncomeTextBox.Text = totIncome


End Sub
End Class

Try

custID = CInt(Me.custIDTextBox.Text)

Hope that helps.

Also you might want to consider assigning this value during the declaration.

Dim custID As Integer = CInt(Me.custIDTextBox.Text)

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