From: Mr. X. on
Hello
I have a function, that I want to pass it via parameter a classType (object
type, or whatever it is called).
I.e I want to send a type : Button, Form, radioButton, etc.

Thanks :)

From: Armin Zingler on
Am 24.04.2010 12:01, schrieb Mr. X.:
> Hello
> I have a function, that I want to pass it via parameter a classType (object
> type, or whatever it is called).
> I.e I want to send a type : Button, Form, radioButton, etc.

Sub bla(byval t as type) 'which is As System.Type

if t is gettype(button) then
elseif t is gettype(form) then
'...
end if

end sub

Call:
bla(gettype(Form))





--
Armin
From: Mr. X. on
1. What I want to do is to make a property, that is a Type (But only type of
Form).
I couldn't find how doing so (I can check on code, but I want also this type
to be checked at design time).
2. I want that any child components of forms will work too - How can I check
that ?
(Is the code, as you described OK :
if t is gettype(form) ' t is a child of form. does this line works too ?)

Thanks :)

"Armin Zingler" <az.nospam(a)freenet.de> wrote in message
news:eLMM3254KHA.980(a)TK2MSFTNGP04.phx.gbl...
> Am 24.04.2010 12:01, schrieb Mr. X.:
>> Hello
>> I have a function, that I want to pass it via parameter a classType
>> (object
>> type, or whatever it is called).
>> I.e I want to send a type : Button, Form, radioButton, etc.
>
> Sub bla(byval t as type) 'which is As System.Type
>
> if t is gettype(button) then
> elseif t is gettype(form) then
> '...
> end if
>
> end sub
>
> Call:
> bla(gettype(Form))
>
>
>
>
>
> --
> Armin

From: Mr. X. on
Sorry.
If t is a form, and any of it's child components ?

I want to do as following :
dim x as t
if t is getType(form) then
x = new Form()
....
x.ShowDialog() ...
end if

How can I do that ?
(Maybe solution for "type", should be "Class" ?)

Thanks :)

"Armin Zingler" <az.nospam(a)freenet.de> wrote in message
news:eLMM3254KHA.980(a)TK2MSFTNGP04.phx.gbl...
> Am 24.04.2010 12:01, schrieb Mr. X.:
>> Hello
>> I have a function, that I want to pass it via parameter a classType
>> (object
>> type, or whatever it is called).
>> I.e I want to send a type : Button, Form, radioButton, etc.
>
> Sub bla(byval t as type) 'which is As System.Type
>
> if t is gettype(button) then
> elseif t is gettype(form) then
> '...
> end if
>
> end sub
>
> Call:
> bla(gettype(Form))
>
>
>
>
>
> --
> Armin

From: Family Tree Mike on
On 4/24/2010 8:33 AM, Mr. X. wrote:
> Sorry.
> If t is a form, and any of it's child components ?
>
> I want to do as following :
> dim x as t
> if t is getType(form) then
> x = new Form()
> ...
> x.ShowDialog() ...
> end if
>
> How can I do that ?
> (Maybe solution for "type", should be "Class" ?)
>
> Thanks :)
>
> "Armin Zingler" <az.nospam(a)freenet.de> wrote in message
> news:eLMM3254KHA.980(a)TK2MSFTNGP04.phx.gbl...
>> Am 24.04.2010 12:01, schrieb Mr. X.:
>>> Hello
>>> I have a function, that I want to pass it via parameter a classType
>>> (object
>>> type, or whatever it is called).
>>> I.e I want to send a type : Button, Form, radioButton, etc.
>>
>> Sub bla(byval t as type) 'which is As System.Type
>>
>> if t is gettype(button) then
>> elseif t is gettype(form) then
>> '...
>> end if
>>
>> end sub
>>
>> Call:
>> bla(gettype(Form))
>>
>>
>>
>>
>>
>> --
>> Armin
>

Inside the if-then-else you know it is a form, so do the coding as follows:

sub bla (byval t as type)
if (t is gettype(Form)) then
dim x as new Form
x.ShowDialog()
end if
end sub

--
Mike