Working with Collections and Datagrids

G

Guest

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?
 
G

Guest

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?
 
S

sloan

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top