Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing control types
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Comparing control types
Divers
Thread ID:
00890743
Message ID:
00890743
Vues:
48
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform