Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

dev578

Need help with VC++ .NET

This topic is 5426 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here is what I have so far: #include <iostream> #include <string> #include <fstream> //#include <windows.h> //Sleep(3000); //#include <time.h> #using #using #using #using using namespace std; using namespace System; using namespace System::Drawing; using namespace System::Windows::Forms; __gc class COneChild : public Form { public: COneChild(void); private: TextBox *Editor; //Establish a TextBox named "Editor" }; COneChild::COneChild(void) { this->Text = "Macro1"; WindowState = FormWindowState::Maximized; Editor = new TextBox(); Editor->AcceptsReturn = true; //allow user to hit enter to go to next line Editor->AcceptsTab = true; //allow tab Editor->Multiline = true; //user can create multiple lines Editor->ScrollBars = ScrollBars::Vertical; //add verticle scroll bar Editor->WordWrap = true; //allows wrapping of text Editor->Dock = DockStyle::Fill; //occupy the whole client area Editor->Text = S""; //text in TextBox "Editor" this->Controls->Add(Editor); //add it to the form } __gc class CMainForm : public Form { public: CMainForm(void); private: MainMenu *MMenu; //establishes main menu void CreateTheMenu(); //call CreateTheMenu function void FormLoad(Object *Sender, EventArgs *Args); //call formload function void OnFileNew(Object *Sender, EventArgs *Args); //call new function void OnFileSave(Object *Sender, EventArgs *Args); //call save function void OnFileExit(Object *Sender, EventArgs *Args); //call exit function }; CMainForm::CMainForm(void) { this->Text = "WoWTool"; this->IsMdiContainer = true; this->add_Load(new EventHandler(this, FormLoad)); WindowState = FormWindowState::Maximized; CreateTheMenu(); } void CMainForm::CreateTheMenu() { MMenu = new MainMenu(); // Create a new main menu column MenuItem *mnuFile = MMenu->MenuItems->Add("&File"); //adds file mnuFile->MenuItems->Add("&New", new EventHandler(this, OnFileNew)); //new mnuFile->MenuItems->Add("&Save", new EventHandler(this, OnFileSave)); //save mnuFile->MenuItems->Add("&Exit", new EventHandler(this, OnFileExit)); //exit Menu = MMenu; //after creating the main menu, add it to the form } void CMainForm::FormLoad(Object *Sender, EventArgs *Args) { OnFileNew(Sender, Args); //creates new instance of child on startup } void CMainForm::OnFileNew(Object *Sender, EventArgs *Args) { COneChild *OC = new COneChild(); //create an instance of the Child OC->Text = S"Macro1"; OC->MdiParent = this; OC->Show(); } void CMainForm::OnFileSave(Object *Sender, EventArgs *Args) { ofstream fout; fout.open("TextBox.txt"); fout << "Save Feature currently not working"; fout.close(); } void CMainForm::OnFileExit(Object *Sender, EventArgs *Args) { Close(); } int __stdcall WinMain() { CMainForm *MF = new CMainForm(); Application::Run(MF); return 0; } Yes, this is a form compiled with VC++ .NET; it has a parent window, with a child window inside it. The child window has a text box. Currently, when the user goes to file-save, it saves a .txt file saying: "Save Feature currently not working". Is there a way I can change my save function to actually save what the user typed in the text box? I know the text in the textbox is represented by Editor->Text, but I can''t seem to get it into a string so I can output it in fout. Anyone that can help a newb?

Share this post


Link to post
Share on other sites
Advertisement
doh, sorry, this message posted twice Last time it crapped out and gave me an error, didn''t think it went through, sorry.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!