Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi folks,

 

i have this sub-routine that needs to be able to take an Object as a parameter. so the routine looks something like this:

 

Sub AlignAlpha(ByRef FormToInitialize As System.Windows.Forms.Form)

.....

End Sub

 

and then i have this form called CourseSelPanel.vb and within it, i need to be able to call the sub-routine AlignAlpha and pass the object CourseSelPanel itself as a parameter.

 

so i guess something like this:

 

Friend Class CourseSelPanel

Inherits System.Windows.Forms.Form

...............

AlignAlpha(pass CourseSelPanel as a parameter???????)

...............

End Class

 

How do i do that?

 

Thanks all.

Posted

oh ok, that makes sense. there is another problem though, the function AlignAlpha will be called from several different forms and it needs to be flexible enough to where it would be able to receive a parameter Object reference to any of those different froms. For example, if i am calling AlignAlpha from the form CourseSelPanel.vb then it should be able to take an Object of type CourseSelPanel as input, if i am calling from another object called ShippingPanel.vb then it should be able to take ShippingPanel Object as an input and so on.

 

i tried declaring the input parameter as a Form, i.e. something like this:

Sub AlignAlpha(ByRef FormToInitialize As System.Windows.Forms.Form),

 

but that didn't give me access to the specific methods for the different forms calling the function. Then i tried declaring is as an Object, i.e.:

 

Sub AlignAlpha(ByRef FormToInitialize As Object),

 

but that only gives me access to one method, GetType.

 

what can i do?

thanks.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...