Board index » Visual Studio » check type of controls

check type of controls

Visual Studio338
This is a multi-part message in MIME format.



------=_NextPart_000_001C_01C50ACE.68DAAEF0

Content-Type: text/plain;

charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



Hi,

i'm using code below to check if control is a button

how can i check for more types of controls(like checkbox,...)

in one 'nice piece" of code

I tried to make a select case with 'typeof...is' but i didn't get it =

work





If Not TypeOf ctr Is Button Then

AddHandler ctr.LostFocus, AddressOf meLostFocus



AddHandler ctr.GotFocus, AddressOf meGotFocus



End If



thanx in advance



stefan



------=_NextPart_000_001C_01C50ACE.68DAAEF0

Content-Type: text/html;

charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

<META http-equiv=3DContent-Type content=3D"text/html; =

charset=3Diso-8859-1">

<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>

<STYLE></STYLE>

</HEAD>

<BODY>

<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>i'm using code below to check if =

control is a=20

button</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>how can i check for more types of =

controls(like=20

checkbox,...)</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>in one 'nice piece" of =

code</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>I tried to make a select case&nbsp;with =



'typeof...is' but i didn't get it work</FONT></DIV>

<DIV>&nbsp;</DIV>

<DIV>&nbsp;</DIV>

<DIV><FONT face=3DArial size=3D2>If Not TypeOf ctr Is Button =

Then</FONT></DIV>

<DIV>

<P><FONT face=3DArial size=3D2>AddHandler ctr.LostFocus, AddressOf=20

meLostFocus</FONT></P>

<P><FONT face=3DArial size=3D2>AddHandler ctr.GotFocus, AddressOf=20

meGotFocus</FONT></P>

<P><FONT face=3DArial size=3D2>End If</FONT></P>

<P><FONT face=3DArial size=3D2>thanx in advance</FONT></P>

<P><FONT face=3DArial size=3D2>stefan</FONT></P></DIV></BODY></HTML>



------=_NextPart_000_001C_01C50ACE.68DAAEF0--


-
 

Re:check type of controls

This is a multi-part message in MIME format.



------=_NextPart_000_003E_01C50ACF.1A9E57E0

Content-Type: text/plain;

charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



sorry,

answer found

Stefan

"Stefan" <st@nospam.com>schreef in bericht =

Hi,

i'm using code below to check if control is a button

how can i check for more types of controls(like checkbox,...)

in one 'nice piece" of code

I tried to make a select case with 'typeof...is' but i didn't get it =

work





If Not TypeOf ctr Is Button Then

AddHandler ctr.LostFocus, AddressOf meLostFocus



AddHandler ctr.GotFocus, AddressOf meGotFocus



End If



thanx in advance



stefan



------=_NextPart_000_003E_01C50ACF.1A9E57E0

Content-Type: text/html;

charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

<META http-equiv=3DContent-Type content=3D"text/html; =

charset=3Diso-8859-1">

<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>

<STYLE></STYLE>

</HEAD>

<BODY bgColor=3D#ffffff>

<DIV><FONT face=3DArial size=3D2>sorry,</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>answer found</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>Stefan</FONT></DIV>

<BLOCKQUOTE dir=3Dltr=20

style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =

BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

<DIV>"Stefan" &lt;<A =

href=3D"mailto:st@nospam.com">st@nospam.com</A>&gt; schreef=20

in bericht <A=20

=

href=3D"news:OyvKHYsCFHA.228@tk2msftngp13.phx.gbl">news:OyvKHYsCFHA.228@t=

k2msftngp13.phx.gbl</A>...</DIV>

<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>i'm using code below to check if =

control is a=20

button</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>how can i check for more types of =

controls(like=20

checkbox,...)</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>in one 'nice piece" of =

code</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>I tried to make a select =

case&nbsp;with=20

'typeof...is' but i didn't get it work</FONT></DIV>

<DIV>&nbsp;</DIV>

<DIV>&nbsp;</DIV>

<DIV><FONT face=3DArial size=3D2>If Not TypeOf ctr Is Button =

Then</FONT></DIV>

<DIV>

<P><FONT face=3DArial size=3D2>AddHandler ctr.LostFocus, AddressOf=20

meLostFocus</FONT></P>

<P><FONT face=3DArial size=3D2>AddHandler ctr.GotFocus, AddressOf=20

meGotFocus</FONT></P>

<P><FONT face=3DArial size=3D2>End If</FONT></P>

<P><FONT face=3DArial size=3D2>thanx in advance</FONT></P>

<P><FONT face=3DArial =

size=3D2>stefan</FONT></P></DIV></BLOCKQUOTE></BODY></HTML>



------=_NextPart_000_003E_01C50ACF.1A9E57E0--



-

Re:check type of controls

"Stefan" <st@nospam.com>schrieb:

Quote
i'm using code below to check if control is a button

how can i check for more types of controls(like checkbox,...)

in one 'nice piece" of code

I tried to make a select case with 'typeof...is' but i didn't get it work



If Not TypeOf ctr Is Button Then



\\\

Dim x As Control = ...

Select Case True

Case TypeOf x Is Button, TypeOf x Is ListBox

...

Case Else

...

End Select

///



--

M S Herfried K. Wagner

M V P <URL:dotnet.mvps.org/>">dotnet.mvps.org/>

V B <URL:dotnet.mvps.org/dotnet/faqs/>">dotnet.mvps.org/dotnet/faqs/>

-

Re:check type of controls

thanx Herfried

that's what i was looking for

kind regards

Stefan

"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at>schreef in bericht

Quote
"Stefan" <st@nospam.com>schrieb:

>i'm using code below to check if control is a button

>how can i check for more types of controls(like checkbox,...)

>in one 'nice piece" of code

>I tried to make a select case with 'typeof...is' but i didn't get it work

>

>If Not TypeOf ctr Is Button Then



\\\

Dim x As Control = ...

Select Case True

Case TypeOf x Is Button, TypeOf x Is ListBox

...

Case Else

...

End Select

///



--

M S Herfried K. Wagner

M V P <URL:dotnet.mvps.org/>">dotnet.mvps.org/>

V B <URL:dotnet.mvps.org/dotnet/faqs/>">dotnet.mvps.org/dotnet/faqs/>





-