Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper way to evaluate
Message
From
01/01/2005 21:23:26
 
 
To
01/01/2005 21:16:34
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
00973604
Message ID:
00973675
Views:
21
Michel,

As I said in my other post, it is because you have not yet instantiated WebServerImage1, WebServerImage2, etc. I initially assumed that these were already instantiated and you were just looking to add the .Image property to all of them. Off the top of my head, I'm not sure how you would go about initially instantiating them dynamically.

~~Bonnie


>>One, I bet your PictureBoxes haven't actually been instantiated yet. This might cause problems because this code assumes that they've already been instantiated.
>>
>>Two, You need to cast the result of the GetField stuff to a PictureBox. I'm sorry, I don't remember the VB syntax for casting.
>
>This is the closest thing I can get:
>
>
>                Dim loType As Type = GetType(PictureBox)
>                Dim loFieldInfo As FieldInfo = loType.GetType.GetField("WebServerImage" + lnCounter.ToString().Trim(), _
>                 BindingFlags.Instance Or BindingFlags.NonPublic)
>                Dim loPictureBox As PictureBox
>                loPictureBox = loFieldInfo.GetValue(loType)
>                loPictureBox.Image = ImageList.Images(0)
>
>
>It is probably close to be workable but the line:
>
>
>                loPictureBox = loFieldInfo.GetValue(loType)
>
>
>is returning an error at run time. It is also the same error as before. The reference is not set.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform