Home All Groups Group Topic Archive Search About
Author
7 Apr 2005 5:53 PM
Michael Rich
I am parsing controls in vb.net and I need to detect if a control is of a
particular type - as follows:

if control.gettype = system.web.ui.htmlconrols.htmlform then
    ' do something here
end if

I have used TypeOf, Is, and all kinds of other things I could think of, but
the compiler keeps telling me that system.web.ui.htmlconrols.htmlform is a
Type and can't be used as an expression.

How can I perform this comparison?

Thanks, and sorry if this is a silly question.

Michael

Author
7 Apr 2005 6:01 PM
Herfried K. Wagner [MVP]
"Michael Rich" <mr***@michaelrich.com> schrieb:
>I am parsing controls in vb.net and I need to detect if a control is of a
> particular type - as follows:
>
> if control.gettype = system.web.ui.htmlconrols.htmlform then
>    ' do something here
> end if
>
> I have used TypeOf, Is, and all kinds of other things I could think of,
> but
> the compiler keeps telling me that system.web.ui.htmlconrols.htmlform is a
> Type and can't be used as an expression.

\\\
If TypeOf Control Is System.Web.UI.HtmlControls.HtmlForm Then
    ...
End If
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>