check type of controls

S

Stefan

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
 
S

Stefan

sorry,
answer found
Stefan
"Stefan" <[email protected]> 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
 
H

Herfried K. Wagner [MVP]

Stefan said:
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
///
 

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

Top