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.