Jennifer,
OK, here's a complete rundown:
I'm assuming you are working with a "Windows Forms" app. If you call the form that you get when you start the project "Form1", this code will show you how to open a new form, and close it by pressing a button on Form1.
First, add another Windows form to the project; call it "Form2".
In that form, add a function, called FormClose10:
public:
void FormClose10()
{[INDENT]this->Close(); // CoolGamer48 is correct, you can just say "Close()" if you want - I'm wordy...[/INDENT]}
In the Form1 designer, add 2 buttons, one labeled "Open" and another labeled "Close".
In the Form1.h file, put the following code:
#include "Form2.h"
right after the "#pragma once" at the top of the file.
In Form1.h, inside the class definition, add the following code:
private:[INDENT]Form2 ^myForm2; // this is different than what I first told you -- sorry
[/INDENT]
In the "Open_Click" routine, add the following code:
myForm2 = gcnew Form2();
myForm2->Show();
In the "Close_Click" routine, add the following code:
myForm2->FormClose10();
That should do it. When you run the program, Form1 will come up with 2 buttons; press "Open" and Form2 should appear... press "Close" on Form1 and Form2 should disappear.
If you have any problems, let me know. I can send a C++ project to you that has this code working if you like.