Wondering how to be notified when datasource changes within an inheriteddatagrid?

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I have a class that inherits from the DataGrid class. I want to know
when the datasource of my datagrid has changed, but want to execute a
function within my extended datagrid class.

For example:
If you drag out a datagrid onto a form, you can assign an event handler
to "DataSourceChanged" event of the datagrid. I wish to execute code
within the extended datagrid class every time the data source changes.

Anyone know how to do this?

Thanks!
 
Jim said:
I have a class that inherits from the DataGrid class. I want to know
when the datasource of my datagrid has changed, but want to execute a
function within my extended datagrid class.

For example:
If you drag out a datagrid onto a form, you can assign an event handler
to "DataSourceChanged" event of the datagrid. I wish to execute code
within the extended datagrid class every time the data source changes.

Anyone know how to do this?

Thanks!

Figured it out:
[within the constructor of the extended datagrid class]
this.DataSourceChanged += new
System.EventHandler(this.HandleDataSourceChanged);
[/end]

Then within the class create a function "HandleDataSourceChanged" to
handle the event.
 

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

Back
Top