Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comparing control types
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Comparing control types
Miscellaneous
Thread ID:
00890743
Message ID:
00890743
Views:
49
Hi,
I'm trying to change the backcolor for specific control types, in the example below for all labels on the form.

I've tried to use 'System.Windows.Forms.Label' but get an error
'label' is a type in 'Forms' and cannot be used as an expression.

I cannot work out what the valid if statement should be:-
        For Each ctrl As Control In Me.Controls
            If ctrl.GetType = System.Windows.Forms.Label Then
                Console.WriteLine("test   " & ctrl.GetType.ToString)
                ctrl.BackColor = Color.FromName("red")
            End If
        Next
Many thanks for any assistance provided
John T Barton
A single picture (or bit of code) is worth a thousand words
Next
Reply
Map
View

Click here to load this message in the networking platform