Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper way to evaluate
Message
De
01/01/2005 21:23:26
 
 
À
01/01/2005 21:16:34
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
00973604
Message ID:
00973675
Vues:
20
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform