Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper way to evaluate
Message
From
01/01/2005 19:04:46
 
 
To
01/01/2005 17:25:05
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
00973604
Message ID:
00973668
Views:
13
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform