CheckBox Binding Issue

Cricket

Active member
Joined
Jan 6, 2005
Messages
28
Location
Hamilton, ON, Canada
Programming Experience
5-10
I keep getting this error when I try to add a new row to a DataSet.

"Additional information: DataBinding could not find a row in the list that is suitable for all bindings"

The particular error is being caused by bound CheckBoxes. I'm sure because if I comment them out everything works fine. These particular CheckBoxes are bound to Yes/No fields in an Access database.

Me.chkPermits.DataBindings.Add("Checked", Me.dsPO, "tblPO.CRPermits")
Me.chkPickUp.DataBindings.Add("Checked", Me.dsPO, "tblPO.CRPickUp")
Me.chkHotTubBase.DataBindings.Add("Checked", Me.dsPO, "tblPO.CRBase")
Me.chkDecking.DataBindings.Add("Checked", Me.dsPO, "tblPO.CRDecking")
Me.chkElectrical.DataBindings.Add("Checked", Me.dsPO, "tblPO.CRElectrical")
Me.chkProvideAssistants.DataBindings.Add("Checked", Me.dsPO, "tblPO.CRProvideAssistants")


Has anyone seen this error before? If so what causes it? Is there a secret to binding CheckBoxes?
 

Cricket

Active member
Joined
Jan 6, 2005
Messages
28
Location
Hamilton, ON, Canada
Programming Experience
5-10
I just tried it and it didn't work=(.

I have however discovered an interesting issue. This error only occurs if the Table is empty. If I add a single row of data the New method will work correctly.

If I'm doing this correct this is a HUGE VB.NET - Access issue! But I can't believe something like this hasn't occured with others. What's the work around? Anyone else seen this before?
 

DavidT_macktool

Well-known member
Joined
Oct 21, 2004
Messages
502
Location
Indiana
Programming Experience
3-5
Checkbox issues

I had checkbox null value problems also. There was confusion between the SQL server allowing nulls and ThreeState checkbox settings in Vis-Studio.net.
Currently, I do not allow nulls at the server level and ThreeState is set to false.

a handy piece of code to check for nulls:

If Not Grid1.Columns("Complete").Value Is DBNull.Value Then
drCurrentNew("Complete") = Grid1.Columns("Date").Value
Else

End If
 
Last edited:
Top Bottom