0

Hi all,

I am new to programming and having been experimenting various codes recently.

I have managed to link 2 form so that when i click a button on Form1, Form2 opens.
I am using the code

Form2^open2 = gcnew Form2();
             open2->Show();

This codes work fine.

Is there a way of opening Form2 so that Form1 closes or so it replaces Form1?

Many Thanks

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by ads1188
0

http://www.daniweb.com/software-development/cpp/threads/341509
Props to AD for this one. I upvoted his post. You should do the same.

Thank you DeanMSands3.

I have used the code below which work brilliantly.

Form2^open2 = gcnew Form2;
this->Hide();
open2-> Show();

I am new to programming and I want to try to understand the code instead of just using it without some reasoning.

Could someone please explain why "^" and "gcnew" is used for?
I understand the 2nd and 3rd line of the code.

I find it much easier by doing an excercise and learning the codes instead of reading a book.

Many Thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.