Главная страница | назад

Article #19588: Form1 Calling Form2

 Question and Answer Database

FAQ4588C.txt - Form1 Calling Form2

Category   :VCL
Platform   :All-32Bit
Product    :All-CBuilder,   

How to call form2 from form1 by pressing
a button on form1?

If Form2 already exists and you want to address a member function or
property, make sure you have used File | Include Unit Hdr in the IDE to
include the .h file you need for Form2, and then simply use
Form2->WhateverYouWantToAccess. The .h file contains a global variable
which is set when the form is instantiated. Have Form2 be in the
autocreate list (Project | Options | Forms).

If you want to display Form2 and suspend operations in your application
until Form2 is completed (i.e. Form2 is a dialogf) use Form2->ShowModal.
Have Form2 at design time be set to be not visible but have it in the
autocreate list.

If you want to create Form2 and display it when the button is clicked,
but not suspent operations in your application, remove the form from the
autocreate list and add its CreateForm call to the button click handler.

5/25/99 11:49:06 AM

Last Modified: 01-SEP-99