Ouch. You should never pass something around as an object that has a deeper
base class. Clearly all Windows forms derive from
System.Windows.Forms.Form, so you should have defined the object as that
instead. Something like this:
Sub MyFunction (passedForm as System.Windows.Forms.Form)
' Do Something with passedForm
End Sub
You could also do this, if you have already imported a reference to
System.Windows.Forms
Sub MyFunction(passedForm as Form)
' Do something with passedForm
End Sub
If you are looking for a particular instance of a form, or a particular form
class, you could define the referenced object in that particular class. The
other choice you could have is to check the type of the passedForm object,
and see if it implements the class or interface you are expecting, and then
cast it into that class. All depends on what you're trying to do... just
don't pass it as an object!
Ryan Gregg