devxlogo

VFP Form Management

VFP Form Management

Question:
How do I call a form from another form using a command button?

Answer:
You can put code into the Click event of the command button that executes a DO FORM command that will bring up the form you want. For example:

  1. Create a form called ParentForm by executing the following command in the Command Window:
    MODIFY FORM ParentForm

  2. Add a command button to this form and put the following code into the Click event of the command button:
    DO FORM ChildForm

  3. Set the caption of the form to “Parent.”
  4. Save the form.
  5. Create a form called ChildForm by executing the following command in the Command Window:
    MODIFY FORM ChildForm

  6. Set the caption of the form to “Child.”
  7. Save the form.
  8. Execute the following command from the Command Window:
    DO FORM ParentForm

  9. Click on the command button. You should see the Child form come up.
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist