Select Case TypeOf Control Possible?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Saumitra Kumar Paul
    New Member
    • Aug 2010
    • 12

    Select Case TypeOf Control Possible?

    Dear Friend,

    I am trying to write code as the following-


    Code:
    For Each ControlObject As Control In Me.Controls
        Select Case TypeOf ControlObject
    
             Case TextBox
    
             Case ComboBox
    
             Case Label
    
        End Select
    Next


    But it says that "Is expected" after the second line. Is there any technique to do it?

    Regards
    SKPaul
  • Dody
    New Member
    • Aug 2011
    • 11

    #2
    try this code
    Code:
        For Each ControlObject As Control In Me.Controls
    
                If TypeOf (ControlObject) Is TextBox Then
    
                ElseIf TypeOf (ControlObject) Is ComboBox Then
    
                ElseIf TypeOf (ControlObject) Is Label Then
    
                End If
        next

    Comment

    • Saumitra Kumar Paul
      New Member
      • Aug 2010
      • 12

      #3
      Thanks Dody, Your soloution works nicely.

      Comment

      Working...