Assigning a WinForms control to a variable

J

Jay Pondy

Is it possible to assign a WinForms control to a variable?

Dim oTB as TextBox
set oTB = TextBox1

Is it possible to pass a WinForms control as a parameter to a sub or func?

private sub MySub(TB as TextBox)
MsgBox TB.Text
end sub

In both cases I get a "Type Mismatch" error which I assume is because VBA is
referencing the default property instead of the object itself. Is there a
work around for this or is this just the way it is?
 
Top