It doesn't work.
If I guess,
I'd say myself that the error is in the starting of the form.h
What if the variables are always reset to 0?
What if the form, would be... in a repeatative process?
So where should I put the variable Tsn11 ?
It should be managed assemblies. You can pack windows forms in to assemblies(DLLs) which can be used with multiple applications. Create a Class Library project and add reference to System.Windows.Forms assembly.
How to divide a class into multi-files(like c# partial)?
C++ or C++/CLI already supports this. One header file and several source files is possible. You can have a MainFormUI.cpp which includes MainForm.h and have methods like InitializeComponent. Another source file say MainForm.cpp which has all other method implementations.
Unfortunately, VS designer won't support this kind of separation and it will always write the auto-generated code to MainForm.h.
It depends on the point of view, just having multiple physical files or having both multiple physical files and the method of class construction. Yes, you can use multiple files (header/source) in C++ as you do in C#. However, the C# partial class is constructed more like a C++ class-namespace hybrid where you can define methods and data members in multiple source files that somehow come together in the scope of one class.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
Nope. Library should be compiled only once and it should be a mixed mode DLL (compiled using /clr). Trick is with header files. When a native user uses your library, he will see only the methods defined for native. Other methods are not seen as those are guarded with _MANAGED preprocessor directive.
1 - You create the library with exported functions and managed wrapper functions. This should be compiled with /clr switch.
2 - Supply the library along with header file. Since header file has preprocessor statements, managed method definitions won't be seen by a native compiler. They still can work with native methods.
Since your DLL is mixed mode, all users require .NET framework to be installed of course.
a) i selected the file .lib and the .h and imported in my project -- done
b) i set in the project properties the linker to point to the lib file --done
c) i set in the project properties the c++ to look for the .h file --done
d) i set in the general project properties to compile using clr
e) my portion of code where i inlude the .h:
g) after that i compile and everything goes fine (i thinked "maybe too simple")
h) i run the application and ....tada error...
An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module.
Additional information: The type initializer for '<Module>' threw an exception.
i googled around and i see is a common problem but i can't find an answer on what i have a todo...a magic code like #pragma something or some compiler settings or somethings....i neither find a good "howTo" on how to do this... can someone help me out or point me to a tutorial - how to ?? thx