Connecting Tech Pros Worldwide Forums | Help | Site Map

I need help with checkboxes and calculating

Newbie
 
Join Date: Mar 2008
Posts: 15
#1: Mar 19 '08
Ok, I need help with putting values of checkboxes in the code,

Heres an example of how my form wil l look like:



Ok I wanted it so The Trivium checkbox would obv equal to £50, so if I checked it, it would be selected and the price would be displayed in total price, and for the part where it says number of adults I wanted to set it so each adults would cost £5+ticket, as an example, below it shud say number of child but I forgot to rename, anyway I really am stuck with the checkbox and how to put those values in.

It's a bit messy there so il try and explain better,


I guess for the first part I would like to find out how to put values in checkboxes and calculate that price, example would be

Trivium select > Current Price in total is £50 (£50 per adult), for 2 adults price would be £100, I guess the number of adults should be default 1,

Price per Child is £25


So If they selected 2 adults and 2 children the total price would be £150, if my maths is correct :)


Anyway my design is a lot bigger than that but if I can figure out how to do those few things then I should be able to do it by myself

Thanks anyway

Newbie
 
Join Date: Mar 2008
Posts: 15
#2: Mar 19 '08

re: I need help with checkboxes and calculating


Ok I found out a few things, just stuck on one part

If CHKtriv.Value = 1 Then
LBLtotal.Caption = "£50"
Else
LBLtotal.Caption = ""
End If

How to expand this, for it to check if the adults, I think the forumula needed it

£50 * Adult value = Adult Price, so it would be £50 * 4 = £200 for 4 adults, but I dont know what code I need for that.
lotus18's Avatar
Site Addict
 
Join Date: Nov 2007
Location: Zamboanga City, Philippines
Posts: 861
#3: Mar 20 '08

re: I need help with checkboxes and calculating


Quote:

Originally Posted by carl2k2

Ok I found out a few things, just stuck on one part

If CHKtriv.Value = 1 Then
LBLtotal.Caption = "£50"
Else
LBLtotal.Caption = ""
End If

How to expand this, for it to check if the adults, I think the forumula needed it

£50 * Adult value = Adult Price, so it would be £50 * 4 = £200 for 4 adults, but I dont know what code I need for that.

Add a command button, then try this
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.    lblTotal.Caption=50*Val(txtNoOfAdults.Text)
  3. End Sub
Just continue...
Newbie
 
Join Date: Mar 2008
Posts: 15
#4: Mar 20 '08

re: I need help with checkboxes and calculating


Ok Thanks, that small code has helped me a lot :D
Newbie
 
Join Date: Mar 2008
Posts: 15
#5: Mar 20 '08

re: I need help with checkboxes and calculating


How to add currency £ ?
QVeen72's Avatar
Moderator
 
Join Date: Oct 2006
Location: Bangalore
Posts: 1,385
#6: Mar 21 '08

re: I need help with checkboxes and calculating


Hi,

Check this :

Expand|Select|Wrap|Line Numbers
  1. lblTotal.Caption=Chr(163) & "  " & 50*Val(txtNoOfAdults.Text)
  2.  
Regards
Veena
Reply