Got a useful answer last time, so worth a try.
I just want to stick all the common functions called from different forms in one place rather than duplicate code, and for some I need to pass forms by reference to those functions. But if I have something like:-
Public Sub EnableDoubleBuffering(ByRef frm As System.Windows.Forms.Form)
in a public module or class, any reference to frm gives 'not accessible in this context because it is protected'.
The solutions I have looked at on the net all seem to to be along the lines of declaring a new instance of, or inheriting from, a specific form class, however:-
a) frm does not necessarily always refer to the same form class
b) frm could refer to different instances of the same form class
I can think of a rather messy solution to a) but not sure how to handle b). Ta for any answers.
I just want to stick all the common functions called from different forms in one place rather than duplicate code, and for some I need to pass forms by reference to those functions. But if I have something like:-
Public Sub EnableDoubleBuffering(ByRef frm As System.Windows.Forms.Form)
in a public module or class, any reference to frm gives 'not accessible in this context because it is protected'.
The solutions I have looked at on the net all seem to to be along the lines of declaring a new instance of, or inheriting from, a specific form class, however:-
a) frm does not necessarily always refer to the same form class
b) frm could refer to different instances of the same form class
I can think of a rather messy solution to a) but not sure how to handle b). Ta for any answers.
Comment