I have an application that is using Datagrids to display a collection of
objects (.Net 1.x, VB.Net environment using Collection Object). The
Collection Object, lets say holds a collection of Customer Objects.
I want the datagrid to be editable, so that users can enter data through the
grid and have it update properties of the specific Customer object.

Also I need for when the users clicks the new row in the datagrid that the
Collection adds a new Customer object to it. The problem I am having is that
when I click the new row in datagrid, I get a system.dll exception.

What I see happening is that when new is clicked in the datagrid, the
collection class returns a New Object(). Is there an event or property that
I need to implement on my Customer Objects so that it will understand the
datagrids request for a new object?

Re: Working with Collections and Datagrids by sloan

sloan
Wed Jul 05 08:50:43 CDT 2006

Do a google search for
IEditableObject.

http://www.google.com/search?hl=en&q=IEditableObject

Its not trivial.... I usually go with a strongly typed dataset for this
specific reason. (the work involved with implmenting IEditableObject)


"Guy Thornton" <GuyThornton@discussions.microsoft.com> wrote in message
news:3659FE33-7008-41C5-B0CC-529232117D41@microsoft.com...
> I have an application that is using Datagrids to display a collection of
> objects (.Net 1.x, VB.Net environment using Collection Object). The
> Collection Object, lets say holds a collection of Customer Objects.
> I want the datagrid to be editable, so that users can enter data through
the
> grid and have it update properties of the specific Customer object.
>
> Also I need for when the users clicks the new row in the datagrid that the
> Collection adds a new Customer object to it. The problem I am having is
that
> when I click the new row in datagrid, I get a system.dll exception.
>
> What I see happening is that when new is clicked in the datagrid, the
> collection class returns a New Object(). Is there an event or property
that
> I need to implement on my Customer Objects so that it will understand the
> datagrids request for a new object?



Re: Working with Collections and Datagrids by GuyThornton

GuyThornton
Wed Jul 05 09:08:02 CDT 2006

I should have be more specific in my description, I have implemented my own
Collection class that implements IList, IBindingList, and ICollection
interaces. I looked at the IEditableObject interace, but am not seeing how
this will correct my problem. It seems that the IEditableObject interface is
more responsible for managing changes to an object and either committing or
discarding those changes when an edit begins or is cancelled. I will
probably need to get to that task next, but for now, I just want return the
correct type of object when a "new" is clicked by the user. Does the
IEditableObject interface handle new object as well?

"sloan" wrote:

> Do a google search for
> IEditableObject.
>
> http://www.google.com/search?hl=en&q=IEditableObject
>
> Its not trivial.... I usually go with a strongly typed dataset for this
> specific reason. (the work involved with implmenting IEditableObject)
>
>
> "Guy Thornton" <GuyThornton@discussions.microsoft.com> wrote in message
> news:3659FE33-7008-41C5-B0CC-529232117D41@microsoft.com...
> > I have an application that is using Datagrids to display a collection of
> > objects (.Net 1.x, VB.Net environment using Collection Object). The
> > Collection Object, lets say holds a collection of Customer Objects.
> > I want the datagrid to be editable, so that users can enter data through
> the
> > grid and have it update properties of the specific Customer object.
> >
> > Also I need for when the users clicks the new row in the datagrid that the
> > Collection adds a new Customer object to it. The problem I am having is
> that
> > when I click the new row in datagrid, I get a system.dll exception.
> >
> > What I see happening is that when new is clicked in the datagrid, the
> > collection class returns a New Object(). Is there an event or property
> that
> > I need to implement on my Customer Objects so that it will understand the
> > datagrids request for a new object?
>
>
>

Re: Working with Collections and Datagrids by sloan

sloan
Wed Jul 05 09:08:25 CDT 2006


I ~think you need a default contructor.
And I think items in your Collection, have to implment the IEditable object.

Buts its been over a year since I last did it, so I can't be authoratative
with these answers.



"Guy Thornton" <GuyThornton@discussions.microsoft.com> wrote in message
news:3CE948E1-77AA-4A01-BD16-790E59E947AF@microsoft.com...
> I should have be more specific in my description, I have implemented my
own
> Collection class that implements IList, IBindingList, and ICollection
> interaces. I looked at the IEditableObject interace, but am not seeing
how
> this will correct my problem. It seems that the IEditableObject interface
is
> more responsible for managing changes to an object and either committing
or
> discarding those changes when an edit begins or is cancelled. I will
> probably need to get to that task next, but for now, I just want return
the
> correct type of object when a "new" is clicked by the user. Does the
> IEditableObject interface handle new object as well?
>
> "sloan" wrote:
>
> > Do a google search for
> > IEditableObject.
> >
> > http://www.google.com/search?hl=en&q=IEditableObject
> >
> > Its not trivial.... I usually go with a strongly typed dataset for this
> > specific reason. (the work involved with implmenting IEditableObject)
> >
> >
> > "Guy Thornton" <GuyThornton@discussions.microsoft.com> wrote in message
> > news:3659FE33-7008-41C5-B0CC-529232117D41@microsoft.com...
> > > I have an application that is using Datagrids to display a collection
of
> > > objects (.Net 1.x, VB.Net environment using Collection Object). The
> > > Collection Object, lets say holds a collection of Customer Objects.
> > > I want the datagrid to be editable, so that users can enter data
through
> > the
> > > grid and have it update properties of the specific Customer object.
> > >
> > > Also I need for when the users clicks the new row in the datagrid that
the
> > > Collection adds a new Customer object to it. The problem I am having
is
> > that
> > > when I click the new row in datagrid, I get a system.dll exception.
> > >
> > > What I see happening is that when new is clicked in the datagrid, the
> > > collection class returns a New Object(). Is there an event or
property
> > that
> > > I need to implement on my Customer Objects so that it will understand
the
> > > datagrids request for a new object?
> >
> >
> >



Re: Working with Collections and Datagrids by sloan

sloan
Wed Jul 05 09:11:17 CDT 2006


Here's an example I found.

http://www.vb-helper.com/howto_net_sort_dataset_collection.html

I don't know of a C# example offhand. ( I had that one in my old bookmarks)



"sloan" <sloan@ipass.net> wrote in message
news:%23h83U0DoGHA.3348@TK2MSFTNGP03.phx.gbl...
>
> I ~think you need a default contructor.
> And I think items in your Collection, have to implment the IEditable
object.
>
> Buts its been over a year since I last did it, so I can't be authoratative
> with these answers.
>
>
>
> "Guy Thornton" <GuyThornton@discussions.microsoft.com> wrote in message
> news:3CE948E1-77AA-4A01-BD16-790E59E947AF@microsoft.com...
> > I should have be more specific in my description, I have implemented my
> own
> > Collection class that implements IList, IBindingList, and ICollection
> > interaces. I looked at the IEditableObject interace, but am not seeing
> how
> > this will correct my problem. It seems that the IEditableObject
interface
> is
> > more responsible for managing changes to an object and either committing
> or
> > discarding those changes when an edit begins or is cancelled. I will
> > probably need to get to that task next, but for now, I just want return
> the
> > correct type of object when a "new" is clicked by the user. Does the
> > IEditableObject interface handle new object as well?
> >
> > "sloan" wrote:
> >
> > > Do a google search for
> > > IEditableObject.
> > >
> > > http://www.google.com/search?hl=en&q=IEditableObject
> > >
> > > Its not trivial.... I usually go with a strongly typed dataset for
this
> > > specific reason. (the work involved with implmenting IEditableObject)
> > >
> > >
> > > "Guy Thornton" <GuyThornton@discussions.microsoft.com> wrote in
message
> > > news:3659FE33-7008-41C5-B0CC-529232117D41@microsoft.com...
> > > > I have an application that is using Datagrids to display a
collection
> of
> > > > objects (.Net 1.x, VB.Net environment using Collection Object). The
> > > > Collection Object, lets say holds a collection of Customer Objects.
> > > > I want the datagrid to be editable, so that users can enter data
> through
> > > the
> > > > grid and have it update properties of the specific Customer object.
> > > >
> > > > Also I need for when the users clicks the new row in the datagrid
that
> the
> > > > Collection adds a new Customer object to it. The problem I am
having
> is
> > > that
> > > > when I click the new row in datagrid, I get a system.dll exception.
> > > >
> > > > What I see happening is that when new is clicked in the datagrid,
the
> > > > collection class returns a New Object(). Is there an event or
> property
> > > that
> > > > I need to implement on my Customer Objects so that it will
understand
> the
> > > > datagrids request for a new object?
> > >
> > >
> > >
>
>



Re: Working with Collections and Datagrids by GuyThornton

GuyThornton
Wed Jul 05 09:29:02 CDT 2006

Thanks for the information. I will see what I can work out.

"sloan" wrote:

>
> Here's an example I found.
>
> http://www.vb-helper.com/howto_net_sort_dataset_collection.html
>
> I don't know of a C# example offhand. ( I had that one in my old bookmarks)
>
>
>
> "sloan" <sloan@ipass.net> wrote in message
> news:%23h83U0DoGHA.3348@TK2MSFTNGP03.phx.gbl...
> >
> > I ~think you need a default contructor.
> > And I think items in your Collection, have to implment the IEditable
> object.
> >
> > Buts its been over a year since I last did it, so I can't be authoratative
> > with these answers.
> >
> >
> >
> > "Guy Thornton" <GuyThornton@discussions.microsoft.com> wrote in message
> > news:3CE948E1-77AA-4A01-BD16-790E59E947AF@microsoft.com...
> > > I should have be more specific in my description, I have implemented my
> > own
> > > Collection class that implements IList, IBindingList, and ICollection
> > > interaces. I looked at the IEditableObject interace, but am not seeing
> > how
> > > this will correct my problem. It seems that the IEditableObject
> interface
> > is
> > > more responsible for managing changes to an object and either committing
> > or
> > > discarding those changes when an edit begins or is cancelled. I will
> > > probably need to get to that task next, but for now, I just want return
> > the
> > > correct type of object when a "new" is clicked by the user. Does the
> > > IEditableObject interface handle new object as well?
> > >
> > > "sloan" wrote:
> > >
> > > > Do a google search for
> > > > IEditableObject.
> > > >
> > > > http://www.google.com/search?hl=en&q=IEditableObject
> > > >
> > > > Its not trivial.... I usually go with a strongly typed dataset for
> this
> > > > specific reason. (the work involved with implmenting IEditableObject)
> > > >
> > > >
> > > > "Guy Thornton" <GuyThornton@discussions.microsoft.com> wrote in
> message
> > > > news:3659FE33-7008-41C5-B0CC-529232117D41@microsoft.com...
> > > > > I have an application that is using Datagrids to display a
> collection
> > of
> > > > > objects (.Net 1.x, VB.Net environment using Collection Object). The
> > > > > Collection Object, lets say holds a collection of Customer Objects.
> > > > > I want the datagrid to be editable, so that users can enter data
> > through
> > > > the
> > > > > grid and have it update properties of the specific Customer object.
> > > > >
> > > > > Also I need for when the users clicks the new row in the datagrid
> that
> > the
> > > > > Collection adds a new Customer object to it. The problem I am
> having
> > is
> > > > that
> > > > > when I click the new row in datagrid, I get a system.dll exception.
> > > > >
> > > > > What I see happening is that when new is clicked in the datagrid,
> the
> > > > > collection class returns a New Object(). Is there an event or
> > property
> > > > that
> > > > > I need to implement on my Customer Objects so that it will
> understand
> > the
> > > > > datagrids request for a new object?
> > > >
> > > >
> > > >
> >
> >
>
>
>

Re: Working with Collections and Datagrids by GuyThornton

GuyThornton
Thu Jul 06 06:41:02 CDT 2006

It would be nice if I could get someone from Microsoft to help out with this
question. The only way I have been able to figure out how to make this work,
is to create a strongly typed collection

"Guy Thornton" wrote:

> Thanks for the information. I will see what I can work out.
>
> "sloan" wrote:
>
> >
> > Here's an example I found.
> >
> > http://www.vb-helper.com/howto_net_sort_dataset_collection.html
> >
> > I don't know of a C# example offhand. ( I had that one in my old bookmarks)
> >
> >
> >
> > "sloan" <sloan@ipass.net> wrote in message
> > news:%23h83U0DoGHA.3348@TK2MSFTNGP03.phx.gbl...
> > >
> > > I ~think you need a default contructor.
> > > And I think items in your Collection, have to implment the IEditable
> > object.
> > >
> > > Buts its been over a year since I last did it, so I can't be authoratative
> > > with these answers.
> > >
> > >
> > >
> > > "Guy Thornton" <GuyThornton@discussions.microsoft.com> wrote in message
> > > news:3CE948E1-77AA-4A01-BD16-790E59E947AF@microsoft.com...
> > > > I should have be more specific in my description, I have implemented my
> > > own
> > > > Collection class that implements IList, IBindingList, and ICollection
> > > > interaces. I looked at the IEditableObject interace, but am not seeing
> > > how
> > > > this will correct my problem. It seems that the IEditableObject
> > interface
> > > is
> > > > more responsible for managing changes to an object and either committing
> > > or
> > > > discarding those changes when an edit begins or is cancelled. I will
> > > > probably need to get to that task next, but for now, I just want return
> > > the
> > > > correct type of object when a "new" is clicked by the user. Does the
> > > > IEditableObject interface handle new object as well?
> > > >
> > > > "sloan" wrote:
> > > >
> > > > > Do a google search for
> > > > > IEditableObject.
> > > > >
> > > > > http://www.google.com/search?hl=en&q=IEditableObject
> > > > >
> > > > > Its not trivial.... I usually go with a strongly typed dataset for
> > this
> > > > > specific reason. (the work involved with implmenting IEditableObject)
> > > > >
> > > > >
> > > > > "Guy Thornton" <GuyThornton@discussions.microsoft.com> wrote in
> > message
> > > > > news:3659FE33-7008-41C5-B0CC-529232117D41@microsoft.com...
> > > > > > I have an application that is using Datagrids to display a
> > collection
> > > of
> > > > > > objects (.Net 1.x, VB.Net environment using Collection Object). The
> > > > > > Collection Object, lets say holds a collection of Customer Objects.
> > > > > > I want the datagrid to be editable, so that users can enter data
> > > through
> > > > > the
> > > > > > grid and have it update properties of the specific Customer object.
> > > > > >
> > > > > > Also I need for when the users clicks the new row in the datagrid
> > that
> > > the
> > > > > > Collection adds a new Customer object to it. The problem I am
> > having
> > > is
> > > > > that
> > > > > > when I click the new row in datagrid, I get a system.dll exception.
> > > > > >
> > > > > > What I see happening is that when new is clicked in the datagrid,
> > the
> > > > > > collection class returns a New Object(). Is there an event or
> > > property
> > > > > that
> > > > > > I need to implement on my Customer Objects so that it will
> > understand
> > > the
> > > > > > datagrids request for a new object?
> > > > >
> > > > >
> > > > >
> > >
> > >
> >
> >
> >