Windows Develop Bookmark and Share   
 index > Windows Forms General > Problem setting checkboxCell.Value = True on first row of a dataGridView
 

Problem setting checkboxCell.Value = True on first row of a dataGridView

We are using this code in a contextMenuStrip to set marked rows or mark all rows.

Dim dgRow As DataGridViewRow

For Each dgRow In dgv.Rows

dgRow.Cells(0).Value = True

Next

The first cell in each row is a checkboxcell.

When we first enter the grid if we invoke this code the first row is not checked until we move off the row.

also if we debug and break here the value is true the checkbox is just not checked.

help please

What are we missing?

judir  Friday, September 14, 2007 10:15 PM
Thank you so much for your response. We found that using 'dgv.EndEdit()' after the 'Next' resolved the problem.
kindr  Sunday, September 16, 2007 5:11 PM

Hi , i think you must set value of checkbox to True by yourself instead of depend on the value that it has now .

You will face this problem if you need to let user check this comboBox and then you take this selected checkBox index , you will find that the CheckBox is checked on Grid , and it's value in runtime is False , and this value will be True if and only if you leave the cell . so you will need to change it's value by yourself in Cell Click Event or CellConentClick event .

I hope this will helpyou .

Pr.Wael  Saturday, September 15, 2007 11:07 AM
Thank you so much for your response. We found that using 'dgv.EndEdit()' after the 'Next' resolved the problem.
kindr  Sunday, September 16, 2007 5:11 PM

You can use google to search for other answers

Custom Search

More Threads

• Problems with file paths
• How add a item to combobox
• Scroll Event in List Box
• Mouse wheel does not work on DataGrid
• listview ImageList problems... Adding to it...
• xml to propertygrid...
• how to typecast a string object to a System.Windows.Form.Form class' object
• textbox validating event
• How to make multiple icons available to Windows shell?
• Getting transparent image to show on top of all other controls in a container?