Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Linking forms

Linking forms

Linking forms

Hi, I'm a Delphi Newbie still at young age. I want to know how to link two or more Forms in one Unit. I have searched and asked everywhere but don't seem to find any helpfull answers. HELP ME PLEASE bomb

RE: Linking forms

Can you explain what you mean by Link two or more forms in one unit? If you want to access resources (variables/methods) of one form, from another form, then add the other form to the uses clause. If you want to define more than one form in one unit, not sure you can do that, and even if you can, I certainly wouldn't recommend it.

RE: Linking forms

I want to use more than one form in a program. I know it's a rookie question but I just started using Delphi a while ago. ex : The first form is the start menu, then when clicked on a button, the form hides and the second form appears.

RE: Linking forms

It's pretty straight forward. Create both of your forms in the designer, and then when you want to show the second form from your main form, you put that option in there. The compiler will put up a message saying something like "form1 references form2 which is in unit2, do you wish to add it?" and it'll go ahead and add it and compile.

As for actually handling the chore, all is required is to reference Form2.Show or Form2.ShowModal (if you want the form to stay until dismissed). If you want to hide the main form, it's Form1.Hide. Close the second form, it's Form2.Close or Form2.CloseModal. If you want to close the second form and reshow the main form (after calling hide), it's the same process, but you might have to call Form1.SetFocus for the form to show up again front-and-center.

Hope that helps.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close