I'm building an application which is composed of many differents tabs. I have created one Form per tab and now just need to be able to switch between them. All those forms are stored inside an array that all the classes can access. When I try switching between tabs, it works one or two times but then the program exits and I get the message : "The program has exited with code -1073741510 (0xc000013a)". I've looked around on the internet but I haven't found any explaination of that error.
At first, I tried to simply hide the Form I was on, create a new instance of the Form the user requested and then show that form at the previous Form's location. It worked. However I would like to be able to only create one Form per tab, which I would do when launching the program, and then to store those Forms inside an array and simply switch between them when needed. This would prevent me from creating a new Form each times the user goes back to the same tab. However, when I try doing so, I get the error I mentioned at the begining.
Here is the code I have in my "Main tab" which allows me to switch to my "Profile tab" :
ProfileForm profileForm = (ProfileForm )formsList[1];
profileForm.StartPosition = FormStartPosition.Manual;
profileForm.Location = this.Location;
profileForm.Show();
this.Hide();
The previous way, I would simply have created a new ProfileForm :
ProfileForm profileForm = new ProfileForm ();
profileForm.StartPosition = FormStartPosition.Manual;
profileForm.Location = this.Location;
profileForm.Show();
this.Hide();
User contributions licensed under CC BY-SA 3.0