New VB Student

I am learning VB online and need some assistance.

I need to declare a module-leve variable named charges and need to code 3 checkbox event procedures so they add the appropriate charge to the Charge variable when the box is selected and subtract the appropriate additional amount from the Charges variable when the box is deselected.

The 3 checkboxes are Tennis = $30, Golf = $25 and $Racquetball = $20.

Can someone help me with writing the psuedocode or the code

Lost in VB



Re: Visual Basic Express Edition Lost in VB

Chris Dunaway

For each checkbox, handle the CheckChanged event. Inside that event you would use code similar to the following:

If CheckBox1.Checked Then

Charge = Charge + ChargeAmount

Else

Charge = Charge - ChargeAmount

End If

That should get you started.

Chris





Re: Visual Basic Express Edition Lost in VB

Solitaire

Declare the module-level variable above the first sub, below the Class statement:

Private Charge As Double

Then the changing value will be recognized by all the subs in the form, and you can use the code suggested by Chris.






Re: Visual Basic Express Edition Lost in VB

New VB Student

Thank Chris

This has me on the right track now. Much appreciated

John





Re: Visual Basic Express Edition Lost in VB

New VB Student

Would Decimal work as well as Double If Double is used then would declare the ChargeAmount variable as a Double