Default
Google

How can I show a second form?

Applies To: C++Builder 1 or higher
Category: Knowledge Base

When I start a new application, C++Builder adds by default a single form. It's very easy to customize this form and C++Builder will display this window automatically. However I need to create a second form and show it or hide it when I want from the first one.
 
 
 1.
  Start a new project using File | New Application.
 
 2.
  Insert a new form using File | New Form.
 
 3.
  Add a Button to your first form. Edit its OnClick event:
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    Form2->Show();
}
 
 4.
  Go to File | Include Unit Hdr... and choose Unit2.
 
The TForm object contains simple methods such as Show, Hide or Close which allow you to control your form. In order to access these methods from another form, you'll have to include the corresponding header file.

C++Builder Developer's Network
Copyright © Yoto Yotov



Acquiring image from ProHosting Banner Exchange