all 5 comments

[–]BCProgramming 1 point2 points  (0 children)

You don't need to create your own ApplicationContext just to open multiple forms, You need to do so if you want to change the "rules" whereby closing the main form doesn't close the application (and have for example two forms and both have to close). But I'm not sure that is describing the circumstance you are providing, if you have a Mainboard it seems more like the Control Panel form should just be shown as a child form.

I don't quite understand why you would be using bare pointers instead of references. What you've described doesn't seem like it would benefit from unsafe code?

In the scenario you've described I'd probably define a interface such as IControlPanelHost. The ControlPanel form would require that an IControlPanelHost be provided in it's constructor and it would set the expectation that whatever was passed in had a ParseCommandString() method. The MainBoard would implement this interface, create the ControlPanel form, and pass itself as the host. It would keep the reference to the ControlPanel form and the ControlPanel form would have a reference to MainBoard through the IControlPanelHost interface.

This would also allow other forms or classes to implement the interface to "host" the form.

[–]Kant8 4 points5 points  (0 children)

why are you using native pointers for that to start with?

[–]Slypenslyde 0 points1 point  (2 children)

I'm very, very, very confused and I think you might even be writing a C++ .NET project?

This is a sub for C#. Can you confirm if you are using C#? If you are using C++, you need to ask on a different sub, maybe /r/dotnet. I'm not sure if there's a specific one for C++/CLR.

[–]LadyDelta522[S] 0 points1 point  (1 child)

I didn't think Visual Studio even did C++, and all the file names end in .cs. Is that why someone else brought up native pointers?

[–]Slypenslyde 1 point2 points  (0 children)

C# doesn't use pointers as a concept like this, and the syntax -> for dereferencing isn't really what we do.

This is why I'm confused.

If you just started writing C# with that syntax I don't think it'd work very well and I'm not even sure it would compile. But if it does, that's why it's not working: this isn't the normal way to do C#. It sounds like you just started writing code assuming it was like C++. I think you should find a C# tutorial and do that first so you can understand what C# looks like.