views:

13

answers:

1

I have a form

Friend Class frmOrganigramma
    Inherits System.Windows.Forms.Form

with a sub

Sub OutList()

How can i launch this sub from another form?

Thanks

+1  A: 

By passing an instance of the first form to the constructor of the second form (also make sure the method is public) or by externalizing this function in some other utility class which you would use from both forms.

Darin Dimitrov
Just a small note, you don't have to pass it in the constructor, you just need to pass that reference, in one way or another. For example, a third party could after creation pass that reference. However, you might want to check out events http://msdn.microsoft.com/en-us/library/aa903294(VS.71).aspx and consider using them instead since you create a looser coupling between the classes
Onkelborg
@Onkelborg, yes good point.
Darin Dimitrov