By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,746 Members | 1,232 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,746 IT Pros & Developers. It's quick & easy.

Checkint the TypeOf as Type...

P: n/a
I'm pretty new (ok, REALLY new) to reflection stuff. It is really coming in
handy right now in a project I'm working on.

I've figured out how to disect a .dll file and get all the modules, then get
all the types. Nice. Lots of types in system.windows.forms.dll!!!!

So, here's what I can't figure out yet. Once I've gotten a type:

for Each T as Type in CurrentModule.GetTypes

I want to test to see if the type is a control or not. Basically I'd like to:

If TypeOf T is Control Then...

But that does not work. My only work around is using an activator and
actually creating an instance of the type and checking that, but this is
SLOOOOOOW.

Is there some way to perform a "TypeOf" on a type without creating an
instance?????

thanks in advance.

--
--Zorpie
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Found it:

If T.IsSubclassOf(GetType(Control)) Then
--
--Zorpie
"Zorpiedoman" wrote:
I'm pretty new (ok, REALLY new) to reflection stuff. It is really coming in
handy right now in a project I'm working on.

I've figured out how to disect a .dll file and get all the modules, then get
all the types. Nice. Lots of types in system.windows.forms.dll!!!!

So, here's what I can't figure out yet. Once I've gotten a type:

for Each T as Type in CurrentModule.GetTypes

I want to test to see if the type is a control or not. Basically I'd like to:

If TypeOf T is Control Then...

But that does not work. My only work around is using an activator and
actually creating an instance of the type and checking that, but this is
SLOOOOOOW.

Is there some way to perform a "TypeOf" on a type without creating an
instance?????

thanks in advance.

--
--Zorpie

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.