By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,359 Members | 1,495 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,359 IT Pros & Developers. It's quick & easy.

Sink managed (DataTable) event from unmanaged class?

P: n/a
I have an unmanaged class which has a member variable:
gcroot<DataTable*> myDataTable;

I would like to sink the RowDeleting event in my UNmanaged class. However,
I can't declare an event handler in the unmanaged class because the types
are managed (compiler error C3265).

For example, I can't declare the following sink:
static void Row_Deleting(Object* sender,
System::Data::DataRowChangeEventArgs* e)

Any ideas?
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Bob Whiton wrote:
I would like to sink the RowDeleting event in my UNmanaged class.
However, I can't declare an event handler in the unmanaged class because
the types are managed (compiler error C3265).

For example, I can't declare the following sink:
static void Row_Deleting(Object* sender,
System::Data::DataRowChangeEventArgs* e)


Hi Bob,
Declaring a function that uses managed types within a native class is
okay. The C3265 error should be referring to something else, like putting a
managed data member in a native class.

Unfortunately, this still does not solve your problem. In order for a
delegate to bind to a function, the function needs to be a member of a
managed class. Thus, the only way for you to create a sink for an event is
to create another managed class that the native class can access.

This is something that we're spending a lot of time thinking about.
Hopefully, the next version of Visual C++ will provide a better means for
accomplishing what you're doing. I'm sorry that it isn't that easy right
now.

Cheerio!

--
Brandon Bray Visual C++ Compiler
This posting is provided AS IS with no warranties, and confers no rights.
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.