Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper way to evaluate
Message
De
01/01/2005 19:04:46
 
 
À
01/01/2005 17:25:05
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
00973604
Message ID:
00973668
Vues:
12
>Basically, you'd need to do something like this (I don't know what your controls are that contain the .Image property, so I'm just calling them object here. You can substitute the correct control:
>
>        For lnCounter = 1 To lnNumberOfServer
>            MyObject = (object)this.GetType().GetField(MyImageName+lnCounter.ToString().Trim(), BindingFlags.Instance|BindingFlags.NonPublic).GetValue(this);
>            MyObject.Image = Image.FromFile(lcStartupDirectory + "..\Images\Green.gif")
>        Next
>
There is a small syntax issue here. My image controls are WebServerImage1, WebServerImage2, etc. So far, I have adjusted the code to this:
        Dim loImage As PictureBox
        For lnCounter = 1 To lnNumberOfServer
                loImage = Me.GetType.GetField("WebServerImage" + lnCounter.ToString().Trim(), _
                 Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic).GetValue(Me)
                loImage.Image = ImageList.Images(0)
        Next
This provides a Object reference not set to an instance of an object error.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform