collection addnew method error

Posts   
1  /  2  /  3
 
    
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 20-Jul-2006 14:52:42   

OK. None of the breakpoints ever get hit once the record is visible and on the screen.

I change the date in the date box and tab out of it and it goes back to the date that was in the db to start with.

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 20-Jul-2006 14:59:21   

hmm. so the property setter isn't called by the control... Really weird.

Can you repro this with a small form, 1 entity and the infragistics date control?

Frans Bouma | Lead developer LLBLGen Pro
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 20-Jul-2006 15:43:40   

yes, and it's even weirder in a simple project confused

it won't work even on a form in a simple project. It does work on a form in my regular project, just not on a user control.

I dropped a infragistics date control on it and bound it like we do in the main project and when I leave the field, it reverts back to the date in the db.

This is in the form load event of the simple project. NoteDate is the field.


Dim col As PremployeeNoteCollection = New PremployeeNoteCollection
        Dim filter As IPredicateExpression = New PredicateExpression

        filter.Add(PremployeeNoteFields.Id = 1)

        col.GetMulti(filter)

        If col.Count > 0 Then
            UltraDateTimeEditor1.DataBindings.Clear()

            UltraDateTimeEditor1.DataBindings.Add("Value", col, "NoteDate")

        End If

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 20-Jul-2006 17:49:19   

Hmm... I don't have that control though... disappointed

Frans Bouma | Lead developer LLBLGen Pro
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 20-Jul-2006 19:07:18   

it does it with a standard date also.


Dim col As PremployeeNoteCollection = New PremployeeNoteCollection
        Dim filter As IPredicateExpression = New PredicateExpression

        filter.Add(PremployeeNoteFields.Id = 1)

        col.GetMulti(filter)

        If col.Count > 0 Then
            'UltraDateTimeEditor1.DataBindings.Clear()
            DateTimePicker1.DataBindings.Clear()

            ' UltraDateTimeEditor1.DataBindings.Add("Value", col, "NoteDate")
            DateTimePicker1.DataBindings.Add("Value", col, "NoteDate")



        End If

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 21-Jul-2006 10:12:52   

Hmm. Will check it out.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 21-Jul-2006 13:01:02   

Strange.

I see the same behavior. So I bound a textbox to the datetime column. Same thing: whatever value I entered, it wasn't set to the property, the property setter was never called. So I set a breakpoint in the propertydescriptor SetValue method, it was never called.

When I bound the textbox to a textfield, it worked.

The datetime never worked.

So I set up the databinding at design time: added a collection to the form, added a bindingsource, set the datasource of the bindingsourec to the collection, set the datasource of the grid to the bindingsource, set the textbox' text property to the bindingsource.requireddate property and the datetime picker value property to the bindingsource.shippeddate property.

And then it worked. I was pretty stumped why it didn't work when I set up the databinding in code.

Then I checked out the generated code by VS.NET: this._theDatePicker.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.bindingSource1, "ShippedDate", true));

So I removed the design time binding of the datetime picker and used that line in code. Notice the 'true' value.

It worked!

Strange though, but databinding is one big pile of misery sometimes anyway, so I'm not surprised...

Frans Bouma | Lead developer LLBLGen Pro
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 21-Jul-2006 14:01:46   

Otis wrote:

Strange.

I see the same behavior. So I bound a textbox to the datetime column. Same thing: whatever value I entered, it wasn't set to the property, the property setter was never called. So I set a breakpoint in the propertydescriptor SetValue method, it was never called.

When I bound the textbox to a textfield, it worked.

The datetime never worked.

So I set up the databinding at design time: added a collection to the form, added a bindingsource, set the datasource of the bindingsourec to the collection, set the datasource of the grid to the bindingsource, set the textbox' text property to the bindingsource.requireddate property and the datetime picker value property to the bindingsource.shippeddate property.

And then it worked. I was pretty stumped why it didn't work when I set up the databinding in code.

Then I checked out the generated code by VS.NET: this._theDatePicker.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.bindingSource1, "ShippedDate", true));

So I removed the design time binding of the datetime picker and used that line in code. Notice the 'true' value.

It worked!

Strange though, but databinding is one big pile of misery sometimes anyway, so I'm not surprised...

Thanks! That fixed it. I don't understand why, but as long as it works... I would have never used databinding if it were up to me. It's had problems ever since it's conception. It's much better now, but it still has problems.

anyway thanks again for all the support. I think the migration is finally done now and everything worked out.

1  /  2  /  3