Answered by:
datagridview checkbox

Question
-
hi everyone can u please tel me how can i put datagridview checkbx condition
i have a datagridview and datagridviw culumn(0) is checkbox
if datagridview culumn(checkbox) is true then code working and the datagridview culumn(checkbox)= false then msgox show("first select any one row")
plz give me a code without using currentcell(0) and selectedcell(0)
because in this datagrigview to many rows thats why i can't use currentcell or selectedcell or selected row
Tuesday, April 19, 2011 8:56 PM
Answers
-
Hi zohaibk,
You could also loop through rows and check each box in this way if not that much of rows.
Dim col As DataGridViewCheckBoxColumn = Column1 For Each row As DataGridViewRow In DataGridView1.Rows row.Cells(Column1.Name).Value = True Next 'or For Each row As DataGridViewRow In DataGridView1.Rows row.Cells(Column1.Name).Value = 1 ' prerequisite: truevalue has been set to 1 Next
Kee Poppy [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Marked as answer by Kee Poppy Tuesday, April 26, 2011 10:41 AM
Thursday, April 21, 2011 7:12 AM
All replies
-
Set the underlying value in the datasource to true or false
Success
CorThursday, April 21, 2011 5:33 AM -
check the post below for reference
OR
Amit Govil(amit.govil@hotmail.com)Thursday, April 21, 2011 5:51 AM -
Hi zohaibk,
You could also loop through rows and check each box in this way if not that much of rows.
Dim col As DataGridViewCheckBoxColumn = Column1 For Each row As DataGridViewRow In DataGridView1.Rows row.Cells(Column1.Name).Value = True Next 'or For Each row As DataGridViewRow In DataGridView1.Rows row.Cells(Column1.Name).Value = 1 ' prerequisite: truevalue has been set to 1 Next
Kee Poppy [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Marked as answer by Kee Poppy Tuesday, April 26, 2011 10:41 AM
Thursday, April 21, 2011 7:12 AM