all groups > dotnet windows forms databinding > august 2006 >
You're in the

dotnet windows forms databinding

group:

Custom Object Events Not Changing DataGridView


Custom Object Events Not Changing DataGridView Ollie
8/25/2006 7:54:02 AM
dotnet windows forms databinding:
Hello

Please help me...

I have created an object and implemented the IBindingList.
The object is as follows:
1 project has many Sections
1 section has many items,
1 item has many lines.

I have bound this object to four datagridviews to display the master-detail
reationships. (Thanks to a previous postee)

1 datagridview to display the project detials
1 datagridview to display the section details
1 datagridview to dsiplay the item details
1 datagridview to display the line details

My problem is this:

I have created events for each property within each object. One of the
properties values in each 'line' is dependent on three other properties in
that same line. I have raised events as these three properties are changed to
notify thr datagridview that the other property has also changed. But my
datagridview is not updating until I click on that property.

I have tried setting the Defaultdatasource update mode as follows on form
load:

dgvLines.DataBindings.DefaultDataSourceUpdateMode =
DataSourceUpdateMode.OnPropertyChanged

This didnt work either?

Any guesses as to what I am doing wrong. I have labelled all my events by
the property name and the "Changed" word after them.

In my line class I am implementing
Implements IEditableObject
Implements IDataErrorInfo

In my lines class I am implementing
Inherits CollectionBase
Implements IBindingList

I am doing every thing dynamically. Even creating the datagrid columns. I
did try using the designer to create the columns, but still didnt work.

I have dived head first into databinding and am drowning, please help me.

Thanks in advance for any suggestions or advice.

Ollie








Re: Custom Object Events Not Changing DataGridView Grady Morgan
8/25/2006 11:36:21 AM
I think you need to implement IRaiseItemChangedEvents, too.

Take a look at BindingList<T>, and see if this could meet your needs
instead of creating a custom collection.

-Grady

[quoted text, click to view]
Re: Custom Object Events Not Changing DataGridView Ollie
8/28/2006 4:26:02 AM
Hello Grady

I have first been searching for some sample code in vb that will illustrate
the prinicple of BindingList<T> or the IRaiseItemChanged events. Do you have
a good links or maybe you could sneak me a poject file? All info I find is in
C#!



[quoted text, click to view]
AddThis Social Bookmark Button