J
John A Grandy
I'm using Option Strict -- because all the gurus say i should
I have a function in a class
MyFunction(ByRef c As Control)
In the calling page I have (for example)
Protected MyHTMLControl As HtmlButton
Protected MyWebControl as Button
If I write the code
MyFunction(MyWebControl)
I get the compile-time error
" Option Strict On disallows implicit conversions from
'System.Web.UI.Control' to 'System.Web.UI.WebControls.Button' "
The code
MyFunction(MyHTMLControl)
gives a similar type conversion error.
Short of writing two versions of MyFunction, how do I get around this
problem?
I have a function in a class
MyFunction(ByRef c As Control)
In the calling page I have (for example)
Protected MyHTMLControl As HtmlButton
Protected MyWebControl as Button
If I write the code
MyFunction(MyWebControl)
I get the compile-time error
" Option Strict On disallows implicit conversions from
'System.Web.UI.Control' to 'System.Web.UI.WebControls.Button' "
The code
MyFunction(MyHTMLControl)
gives a similar type conversion error.
Short of writing two versions of MyFunction, how do I get around this
problem?