Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call Form_Load from another form

Status
Not open for further replies.

wvandenberg

Technical User
Oct 24, 2002
125
CA
Hi all,

I have two forms, FormA and FormB and Form A has a treeview control and two listviews. I open FormB with a button on FormA. I enter data into FormB and when it closes I set the focus back to FormA. I am trying to reload the treeview when I set the focus back to FormA so it reflects the new information I've entered in FormB. The code to load the treeview is contained in the OnOpen event of FormA so I tried making the Form_Open event of FormA public and then called it from the OnClose event on FormB but I get and error. I also tried making another public sub called RefreshTree in which I call the Form_Load event of FormA and I get the same error (2465 Application-defined or object-defined error).

Is it possible to call the Form_Load event from another form or do I have to go about this some other way? I know I've done something like this before but I just can't get this on to work.

Thanks in advance,
Wendy
 
You need to specify the form class to do that.
call Form_frmA.Form_Load
 
It is probably best to put the relevant code in a public sub or function. If you really want to use the Form_Load event, you will need to ensure it is not private, in addition to MajP's notes.
 
MajP, I get the error "Method or data member not found" any ideas?

Remou, If I can't get this to work that's what I'll probably do.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top