Click here to Skip to main content
15,893,337 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All

I am developing an application for school.
There is a Form for Fees calculation, This Form contains one DataGrid and a Textbox control.

Data will be populated from databse to datagrid, which will be queried, and i have to add one more column for checkbox inside datagrid control.

After checking the (some or all) checkboxes the relevant fees of courses should be calculated and should be displayed inside textbox.

how can i do this.................??

it is windows application.

please help.........
Posted
Updated 10-Nov-11 2:22am
v4
Comments
Pandya Anil 10-Nov-11 7:43am    
is this a web or windows application?
yogesh89 10-Nov-11 7:46am    
it is windows application.

Ok edited the answer as per your requirement

http://www.syncfusion.com/FAQ/windowsforms/faq_c44c.aspx#q754q
 
Share this answer
 
v3
Comments
yogesh89 10-Nov-11 8:30am    
thnks.....for this link.......
Anuja Pawar Indore 10-Nov-11 8:38am    
Welcome Yogesh :)
add a DataGridViewCheckBoxColumn to your DataGridView at relevant position.

in buttonCalucate_Click event.. loop through all the rows as follows and do total of the selected rows.

C#
double dblTotal = 0.0;
foreach (DataGridViewRow row in dataGridView1.Rows)
{             
   DataGridViewCheckBoxColumn colObj = row.Cells[0] as DataGridViewCheckBoxColumn ;

   if (colObj.Selected)
   {
      dblTotal += convert.toDouble(row.Cells[1].Value.toString());
   }
}
 
Share this answer
 
Comments
yogesh89 10-Nov-11 8:07am    
thanks for your reply but it is datagrid control not datagridview control.
Pandya Anil 10-Nov-11 8:50am    
but you got the basic logic behind that.. thats what I am here for :)

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