check type of controls

  • Thread starter Thread starter Stefan
  • Start date Start date
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
 
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
 
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
///
 
Back
Top