Type comparisons

  • Thread starter Thread starter Michael Rich
  • Start date Start date
M

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
 
Michael Rich said:
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
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top