tags:

views:

33

answers:

3

Is there a way to import a C# windows form and user control into C++.NET? I'm using VS2008 and have VS2010 installed as well.

A: 

There's a plugin for reflector that will render the code as C++ (http://www.sandpapersoftware.com/Main/Reflector.html) - open your compiled-from-c# dll with that...

Rob Fonseca-Ensor
+3  A: 

If you have a .NET assembly or control in an assembly it doesn't matter wheter you code and use it from managed C++, C# or VB.NET or any other .NET language, that's one of the reasons why .NET was invented: be language independent.

To use it: simply reference the .NET assembly in the new project.

jdehaan
Alright, did that. And I can run the form from my managed C++ main. The question is, would I be able to wire the form in such a way that the events the form generate go directly into my C++ instead of the C# code?
If these events are public just do it, it'll work, only the language differs, the underlying .NET generated assembly possesses all the mechanisms you are used to. See doc here: http://msdn.microsoft.com/en-us/library/7kz5cx8k.aspx
jdehaan
A: 

Move your UserControl into a Class Library project and add this project as a reference.

BlueCode