S
Steve Ricketts
I'm converting a VB 6 program to VB.net and in one subroutine a form is
passed by reference. Only forms that have been set up properly by the
application will be passed to this sub.
public sub setupForm(byRef theForm as System.Windows.Forms.Form)
if theForm.lstFormControls.ListCount > 0 then ' <-- error here,
lstFormControls is not a member of "System.Windows.Forms.Form"
....
The application will always pass the form with a listbox control called
lstFormControls. However, the compiler generates an error at each
reference, lstFormControls is not a member of "System.Windows.Forms.Form".
I tried CType(theForm,form).lstFormControls, thinking I'd get away with it
through late binding but got the same error. Obviously, lstFormControls is
not a standard member of Form, but how do I get the compiler not to worry
about this and let it get handled at runtime? I use this sort of technique
throughout the VB6 program so I'm looking for sort of a generic answer that
I can apply to other instances.
Thanks for any direction you can provide
Steve
passed by reference. Only forms that have been set up properly by the
application will be passed to this sub.
public sub setupForm(byRef theForm as System.Windows.Forms.Form)
if theForm.lstFormControls.ListCount > 0 then ' <-- error here,
lstFormControls is not a member of "System.Windows.Forms.Form"
....
The application will always pass the form with a listbox control called
lstFormControls. However, the compiler generates an error at each
reference, lstFormControls is not a member of "System.Windows.Forms.Form".
I tried CType(theForm,form).lstFormControls, thinking I'd get away with it
through late binding but got the same error. Obviously, lstFormControls is
not a standard member of Form, but how do I get the compiler not to worry
about this and let it get handled at runtime? I use this sort of technique
throughout the VB6 program so I'm looking for sort of a generic answer that
I can apply to other instances.
Thanks for any direction you can provide
Steve