Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I've a combbobox (cbtables) which get its tables from sql server,
a datagridview (dgvrecords) which displays the table records when selected and
and four checkboxes (PN,CI,FI and RE) outside dvgrecords but rather in a groupbox. And maybe a Button (btnShow) to display the selected checkboxes.

If a checkbox is clicked, the clicked option and the relating columns shd be SUM and displayed and if mutiples checkboxes are clicked it shd combine and display.

I dont know how to correctly realize the problem.
An example to demostrate my problem:

The combobox and the checkboxes:
PN = ProjectNr
CI = City
FI = FKZ
RE = Region

[  cbtables  ]

[] PN
[] CI
[] FI
[] RE


The datagriview with some records:
ProjectNr  Region     FKZ   City      ABamount1  ABamount2   CFamount   …..
A.1234      North     LA    Accra      4000          -         1500     ….
A.1234      North     LA    Accra      6000        2000        7000     ….
A.1234      North     LI    Accra      8000        3000        3100     ….
Z.9012      Central   A     Togo       6000        5000        250      ….
Z.9012      Central   B     Togo       2500        1000        8000     ….
B.5678      South     LX    London     6000         -          2700


Experted Solutions:
[x] PN

ProjectNr    ABamount1  ABamount2   CFamount   …..
A.1234        18000       5000        11600    ….
Z.9012        8500        6000        8250    ...
B.5678        6000         -          2700  


[x] PN
[x] FI

ProjectNr      FKZ        ABamount1    ABamount2     CFamount   …..
A.1234          LA          10000        2000          1500     ….
A.1234          LI          8000         3000          3100     ….
Z.9012          A           6000         5000          250      ….
Z.9012          B           2500         1000          8000     ….
B.5678          LX          6000         -             2700



[x] RE
[x] PN
[x] FI

ProjectNr  Region     FKZ   City      ABamount1  ABamount2   CFamount   …..
A.1234      North     LA    Accra      10000       2000        1500     ….
A.1234      North     LI    Accra      8000        3000        3100     ….
Z.9012      Central   A     Togo       6000        5000        250      ….
Z.9012      Central   B     Togo       2500        1000        8000     ….
B.5678      South     LX    London     6000         -          2700


Is it possible. will appreciate your contributions
Posted
Updated 31-Jan-15 2:27am
v2
Comments
mikybrain1 31-Jan-15 8:21am    
They are the column names
PN = ProjectNr
FI = FKZ
RE = Region
CI = City
BillWoodruff 31-Jan-15 9:04am    
In this case you calculate the sums and populate the DataGridView based on which CheckBoxes are checked ? Or, is the DataGridView showing "everything," and you want to display the results of checking the CheckBoxes in some other Control ?
mikybrain1 31-Jan-15 9:08am    
Yes i want it to calculate the sums and then populate the dgv based on the checkeboxes checked.
BillWoodruff 31-Jan-15 23:48pm    
Let me ask you what ... at this point ... is keeping you from "realizing the problem:" are you familiar with using structured query language (SQL) with the database to return datasets that require computation, or are you thinking you want to use Linq on the DataTables directly to produce the required dataset you'll then bind to the DataGridView ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900