PDA

View Full Version : call form 1 from form 2



saff
13th December 2010, 13:57
How do I call the first form from the second form?

saff

squidge
13th December 2010, 14:13
In what way? You want to open the first form? Call some method if it? Access some ui element?

Regardless, it's just standard C++, access the object and use the public methods you disclosed. Note that by default ui elements are private and so can not be accessed from another class.

saff
13th December 2010, 14:27
its a login form, so i want to show the login form (which is the main form) from form 2 once a button is clicked

saff

Added after 9 minutes:

the main form loads but then exits straight away.

FelixB
13th December 2010, 15:30
what is your login form supposed to be? a modal dialog?

squidge
13th December 2010, 18:15
try loginForm->exec()