Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 460
  • Last Modified:

how to check if a form has been created in c++

Borland C++ Builder 5

How can I check if a Form has been created? if it exists?
Somewhere I do:

Form4 = new TForm4(this);

Meanwhile program is doing other stuff including displaying variables on Form4 but has to do this ONLY if Form4 exists.

Anyone can help me out?

1 Solution

If Form4 is a pointer of TForm4, and I think it is since you're using "new" to create it, you can verify that the form exist by checking if our pointer is Null:

  if (Form4 != NULL)
    //displaying variables on Form4

If you are doing this test outside of the fonction in witch the Form4 was created, Form4 must be a global variable. So it a to be declare in your .h file with  #include <the unit containing TForm4>

It work fine for me on C++ Builder 6 so it will probably work on C++ Builder 5.

Hope this is what you were looking for.


Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now