Executing a method in one form from another

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to exceute a method in a form from another form... Both forms will always be open so I don't have to worry about that... I just need to call the method... Please help... Source please...
 
Hi Anthony

There are different sce... where you can implement. For both the solutions you need to have a Public function only

1. If you those two forms are MDI Child forms, then you can get the instances using MdiChildren property of the mdiform and call the function
2. If they are not related, what you can do is, have public module and declare objects for both the forms. and assign the form opened to these corresponding object, use these object to invoke the function

Sadha Sivam
Malleable Minds Software
India
Micorsoft India Community Star.
 
Hi Anthony,

I posted a simialr question to the list just below you. I had found the
following solution in the archives and was asking if this was the correct
way of going about things - it does work for me:-

The answer that I have found is to create a module with a Sub Main in it and
set this as the Startup Object:-

Module Startup
Public myMainForm As Form1
Sub Main()
myMainForm = New Form1
Windows.forms.Application.Run(myMainform)
End Sub
End Module

Best wishes

Paul Bromley


Anthony Nystrom said:
I need to exceute a method in a form from another form... Both forms will
always be open so I don't have to worry about that... I just need to call
the method... Please help... Source please...
 
Back
Top