Why my Databinding Null Value Rollsback to null?

Posts   
 
    
LLBLGen
User
Posts: 43
Joined: 10-Apr-2006
# Posted on: 05-Oct-2006 16:52:40   

For example i have

BookCategoryId (int) that allows null. I am using this in the WinForm to bind it to a DropDown..so the user can select one from many book categories.

When user selects a book category from the drop down ("BookCategoryComboBox") and tabs to next control the value that user selects on the BookCategoryComboBox goes back to empty + the PropertyChanged event do not fire..

But if i change the BookCategoryId (int) to not allow null it works fine.. do i have to do something more for the nullable fields?

this is my binding..

{ ... BookCategoryComboBox.DataBindings.Add("Value",Book,"BookCategoryId"); }

this is the PropertyChanged event..

Book.PropertyChanged += new PropertyChangedEventHandler(Book_PropertyChanged);

i am using Adapter, LLBL V2, WinForm, .Net 2.0

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 06-Oct-2006 14:37:37   

If it's a nullable type, you should use the other overload of DataBindings.Add(), the one with 4 parameters and pass true as the forth parameter. Don't ask me why, but that seems to fix it.

Frans Bouma | Lead developer LLBLGen Pro