vendredi 25 mars 2016

how can i check if checkbox is checked in datagridview column in vb.net

i am currently creating a billing system and i am having trouble with checking if a checkbox is checked within a datagridview.

My datagridview currently contains the following columns:

0 : Product Code

1 : Description

2 : Size

3 : Cost

4 : Quantity

5 : Return?

(Datagrid not bound to anything)

The "Return?" column is the checkbox column. This is so that if the user is returning items, then they can check the checkboxes for each item they are returning which will then carry out a different set of code depending on if the checkboxes are checked or not.

For Example: If the user it returning an item costing £20 and purchasing an item that costs £50 then the system should present the user with a total cost of £50 However, if the user is purchasing both items then the system should output £70.

This will all depend on weather or not the return checkbox is checked.

The code that carries out this calculation i have no problem with, i have already written it. However, it is the code that checks weather or not any of the checkboxes are checked within the specified datagridview column.

I assumed it was similar to the code that would be used for a normal checkbox 'If Checkbox1.CheckState = CheckState.Checked then ...' but it is not.

I hope i have made my scenario and problem clear to understand and that someone can help, thanks.




Aucun commentaire:

Enregistrer un commentaire