Form Controls and Objects

Indexing Controls (refer to them by index number) Use a group box Stopping Refresh Of A Control ListBox->BeginUpdate(); //Supress drawing the listbox . . . ListBox->EndUpdate(); //Resume drawing of the list box Tab Control To see which tab is active use:- if (TabName->Visible) Visible doesn’t dictate if a tab is displayed, it tells you if […]

Read More

Add a form from another project

Copy the .h, .cpp and .resx files into the project directory. Right click the project name in the solution explorer and use 'Add Existing Item' to add them to the project. Select the .h file and then in the properties change the file type from "C++ Class" to "C++ Form" Troubleshooting missingmanifestresourceexception error Wth an […]

Read More

Calling A Form Control Event

The maximum value of a scrollbar can only be reached programmatically. The value of a scroll bar cannot reach its maximum value through user interaction at run time. The maximum value that can be reached through user interaction is equal to 1 plus the Maximum property value minus the LargeChange property value. If necessary, you […]

Read More

Create New Form

Creating The Form Project > Add New Item > Windows Form. Name it using 'frm' at the start (our convention) Set the 'Form Border Style' Set 'MaximiseBox' and 'MinimizeBox' properties Set StartPostion Set 'Text' Set 'icon' (or turn off ShowIcon) Nice Things To Do Add this before the constructor //********************************* //********************************* //********** CONSTRUCTOR ********** //********************************* //********************************* […]

Read More

.General Form Usage

Opening a form #include "FormName.h" //Add this at top of file frmConfiguration ^ConfigForm = gcnew frmConfiguration(); ConfigForm->PassedValue1 = "This is a string I'm passing"; //TO OPEN AS A DIALOG FORM: ConfigForm->ShowDialog(); //or if (ConfigForm->ShowDialog() == System::Windows::Forms::DialogResult::OK) else if (ConfigForm->DialogResult == System::Windows::Forms::DialogResult::Cancel) //TO OPEN NOT AS A DIALOG FORM: ConfigForm->Show(); Closing a form Close(); //or this->Close(); […]

Read More

Focus

Detecting Form Has Got Focus Use the ‘Activated’ event Bring Form To Front this->BringToFront(); Does A Specific Control Have Focus? if (txtMyTextBox->ContainsFocus) Give an object on the form focus //Use the objects focus property: ObjectName->Focus(); //or give the form itself focus: frmMyForm->Focus(); Forcing a form to always be on top Set the forms ‘Top Most’ […]

Read More