Hey all,
I am designing a budgeting program, not for any particular reason, and am having trouble with my new budget "wizard". I'm just storing the budget info in an xml file, and so far the program can load and modify info (I've yet to implement saving), but it cannot create a new budget file. I have several forms opening successfully off the main window (Home.h), but am having trouble in this particular instance.
Goal: when a user goes to file->new, they get a "wizard" of sorts with four screens:
1) welcome/give the budget a name
2) add income categories
3) add expense categories
4) congratulations/finish
Right now the first screen is opening properly using the following code in Home.h. The problem is progressing to the next window.
#include "NewBudget1.h"
...
//create a new budget
private: System::Void newBudgetToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
NewBudget1 ^nb1 = gcnew NewBudget1;
nb1->ShowDialog();
}
In NewBudget1 I have a welcome message and text box for the name, and next and cancel buttons. Here is the appropriate code for the next button:
#include "NewBudget2.h"
...
this->btnNext->Click += gcnew System::EventHandler(this, &NewBudget1::btnNext_Click);
...
private: System::Void btnNext_Click(System::Object^ sender, System::EventArgs^ e) {
NewBudget2 ^nb2 = gcnew NewBudget2;
this->Close();
nb2->ShowDialog();
}
My goal for the above code is to have the next form replace the first form, but I get the following compile errors:
Error 1 error C2065: 'NewBudget2' : undeclared identifier ...\NewBudget1.h 163
Error 2 error C2065: 'nb2' : undeclared identifier ...\NewBudget1.h 163
Error 3 error C2061: syntax error : identifier 'NewBudget2' ...\NewBudget1.h 163
Error 4 error C2065: 'nb2' : undeclared identifier ...\NewBudget1.h 165
Error 5 error C2227: left of '->ShowDialog' must point to class/struct/union/generic type ...\NewBudget1.h 165
I'm pretty sure that if I fix the first error the others will go away, but I can't figure why it can't find NewBudget2 when I have the include there right at the top. I've tried switching NewBudget2 for another random subform (New Category form), and that works fine. I get the same problem in NewBudget2 when trying to go forward to NewBudget3 or back to NewBudget1, using the same code.
While I'm far from a C++ expert, I'm not a completely new to it either. I'm very close to finishing the program, and this is the first time I've had to seek help from a source other than Google. I'd appreciate any help, as I'm stumped.
Thanks,
--Rikki