View Single Post
  #9 (permalink)  
Old September 13th, 2004, 07:16 AM
bmains bmains is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

When you open a form, you typically do:

objForm = New Form1
objForm.Show()

Now say you want to pass in a reference to the current form (pass in a reference of the currently opened form to Form1, you could do:

objForm.DoSomethingWithForm(Me)

That function would be defined as:

Public Sub DoSomethingWithForm(ByRef objForm As Form1)
  'code here
End Sub

Also, I like to set the owner property, which is the reference to the owner form. So what I do is:

objForm = New Form1
objForm.Owner = Me
objForm.Show()

And in the Form1 code, you reference the owner.

Brian
Reply With Quote