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.