I have a checkbox in a datagridview and it is passing a null value instead of a false/0 when user doesn't click on it. How can I change it, so it passes a value. I already tried passing values explicityly through the bounddatacolumn properties in the datagridview...

checkbox control passing null value in datagridview
aCaen
newbie911
lordJapheth
The value passed is not even null. there fore I had to convert to a string and then compare its length..
private void DGView_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
{
int RowEdited = e.RowIndex;
if (DGView["MfgColumn",
RowEdited].Value.ToString().Length <= 0)
DGView["MfgColumn", RowEdited].Value = 0;
}
Boulderdude
socko
How are you getting the values This works for me
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim chkCol As New DataGridViewCheckBoxColumn
chkCol.Name = "CheckMe"
chkCol.HeaderText = "Check Me"
DataGridView1.Columns.Add(chkCol)
DataGridView1.AllowUserToAddRows = False
DataGridView1.RowCount = 5
For Each r As DataGridViewRow In DataGridView1.Rows
Dim val As Boolean
val = CBool(r.Cells(0).Value)
Trace.WriteLine(val)
Next
End Sub
End Class
gevans