Hey guys I am a newbie to VB and need help with this form,
The idea is that people enter there age and if they over 65 and are a member its one price, if they are under 65 its one price and if they are not a member it is one price. Age is entered into a textbox, memberahip is indicated by a checkbox and the price is then displayed in a textbox. Anyway I a confused about why it is not calculating. Here is what I have so far. Again I am very new to VB.

Public Class Form1

    Private Sub btnPrice_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrice.Click
        Dim getAge As Integer = txtAge.Text
        Dim isChecked As Integer = chkMemeber.Checked
        Dim showPrice As Integer = txtPrice.Text
        If getAge > 65 And isChecked = True Then
            txtPrice.Text = 5
        ElseIf getAge < 65 And isChecked = True Then
            txtPrice.Text = 10
        ElseIf isChecked = False Then
            txtPrice.Text = 20
        End If


    End Sub
End Class

Hai !
Error is the variable isCheskde should be Boolean.

I'm wonder why are you declare variable named showPrice. you never use it.

It is still not working, here is what I have:

Public Class Form1

    Private Sub btnPrice_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrice.Click
        Dim getAge As Integer = txtAge.Text
        Dim isChecked As Boolean = chkMemeber.Checked

        If getAge > 65 And isChecked = True Then
            txtPrice.Text = 5
        ElseIf getAge < 65 And isChecked = True Then
            txtPrice.Text = 10
        ElseIf isChecked = False Then
            txtPrice.Text = 20
        End If


    End Sub
End Class

line 7 correct as

If getAge > 65 And isChecked == True Then

and also line 9

ElseIf getAge < 65 And isChecked == True Then

I think it's ok

Its giving me an error with ==, it only accepts =

line 7 correct as

If getAge > 65 And isChecked == True Then

and also line 9

ElseIf getAge < 65 And isChecked == True Then

I think it's ok

It works!

change line 9 as

Dim isChecked As Boolean = chkMemeber.CheckState
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.