|
A very simple C++ .NET problem.
I took a class this Spring '05 that covered VB.NET and plunged students into programming with little more than "Here's how you make it do this." However, I had two semesters of C/C++ under my belt (using Visual Studio .NET 2003), and I had a lot of fun learning new ways of doing things I already knew.
I've found, though, that there is something I can do in VB that I can't in C++, and I really think I should be able to.
(Assuming you're using VS.NET 2003)
1.) Start by creating a New Windows Forms Application.
2.) The class for this new form is always affectionately named Form1.
3.) From the project menu, add a new item - another Windows Form (I named mine Form2 so that Form1 wouldn't have any hard feelings).
4.) Put one button on each form that creates a new instance of the opposite form, and makes it visible to the user. Say the code looks like this:
//In the Form1.h file...
Form1_button1_Click(...)
{
(new Form2())->Show();
}
//In the Form2.h file...
Form2_button1_Click(...)
{
(new Form1())->Show();
}
It doesn't compile. Neither form can find the definition of the other, even though Intellisense loves you, and both are declared in the same namespace. I've attempted many solutions, but none are worth mentioning because I desire A.) both buttons, on B.) separate classes, in C.) separate files, to behave. Follow the same procedure in VB.NET, and things flow smoothly. Guh... anyone have any suggestions?
|