my_lou Posted November 19, 2003 Posted November 19, 2003 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. Quote
Moderators Robby Posted November 19, 2003 Moderators Posted November 19, 2003 if you want to pass a form as parameter then pass Me, Quote Visit...Bassic Software
my_lou Posted November 19, 2003 Author Posted November 19, 2003 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. Quote
Moderators Robby Posted November 19, 2003 Moderators Posted November 19, 2003 Then you need to declare it as the actual form itself not as System.Windows.Forms.Form Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.