Sunday, December 18, 2011

5-Tutorial 5 : Menus Using Visual C++.NET 2010, 2008

Tutorial 5 : Menus Using Visual C++.NET 2010, 2008
        In this tutorial you will add a Menu to make button and textbox appear. Click here for the source code to the Menus Program in Visual C++.NET for the 2010 version or click here to download the 2008 version. To add a menu to your form go to the toolBox and double Click on the the mainMenu tool. This will add a menu to your form. Then type "&File" where it says "Type Here", which add File to the Menu. Then in the box below "File" type "&Make Button Appear" and then "M&ake TextBox Appear", then a lone hyphen (-), and then E&xit. The form should look something like this:   
Menus and Visibility
        Then add the following code to the appropriate item in the menu by double clicking on this item to get to its Code Window. To add code to specific menu items, double click on the menu item to bring up the code window.:
private: System::Void makeButtonAppearToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
     {
       button1->Visible=true;
     }
private: System::Void makeToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
     {
       textBox1->Visible=true;
     }
private: System::Void exitToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
     {
       System::Environment::Exit(System::Environment::ExitCode);
     }
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
     {
       button1->Visible=false;
       textBox1->Visible=false;
     }

0 comments:

Post a Comment