BindingManagerBase.AddNew

angula

Active member
Joined
Jul 11, 2003
Messages
35
Using the BindingManagerBase.AddNew method on a form with CheckBoxes, I get
the error: Object cannot be cast from DBNull to other types.

My CheckBoxes are bound via the DataBindings - Checked property at design
time.

I have read that this is a bug. Can anyone confirm this or does anyone have
a suggestion on how to overcome this?

Thanks.
 
;)

I also had the same problem and i managed to overcome using event handler

add the following code segment to initial binding procedure

dBindins = New Binding("checked", ds.Tables"NyTableName"), "MyColumnName")

AddHandler dBindins.Format, AddressOf FormatHandler

CheckBox2.DataBindings.Add(dBindins)

Then create a custom procedure call "FormatHandler" as described bellow

Public Sub FormatHandler(ByVal sender As Object, ByVal e As ConvertEventArgs)
If IsDBNull(e.Value) Then
e.Value = False
End If
End Sub

regs

Kris_xx
 
Back
Top