Question Adding Values conditionally

QinetiQ

New member
Joined
May 9, 2009
Messages
2
Programming Experience
Beginner
Hi there,

I'm new to this place so please excuse me if I'm posting this at the wrong section.

OK, I am using VB 2008 and I am quite stuck. Take a look at the screen shot below. What I'm trying to do is when I tick multiple options on the DataGridview, the total value (Price) of the selected items to be calculated and displayed in the textbox on the right. Anyone got a clue how to do that? Thanks in advance peeps :)

3509890_644x715.jpg
 
Last edited:
Add a column to your table and set its expression to:

SUM(IF([yes_no_column],[price_column],0))

You may have to play around with this a bit, or use two columns (one for the if, then one for the sum)

Now bind your text box to the sum column.. Basically every row will have a sum col of the sum of the chosen options, so whatever is the current row, the sum textbox remains the same value

This will make sense when you do it.. :)
 

Latest posts

Back
Top