Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie Question
Message
 
À
13/10/2008 10:15:58
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01354574
Message ID:
01354580
Vues:
24
This message has been marked as the solution to the initial question of the thread.
Move this.pictureBox1.Image = objpictureboximage; after the InitializeComponent();

The components on the form has not been initialized until after InitializeComponent(); so the form doesn't know about the pictureBox1 control (yet)

Thanks,
Einar

>C# 3.0
>
>VS 2008
>
>Please help this .NET newbie who is drowning!
>
>I'm trying to instantiate a form (OK that's a VFP term, I know!) and change the picturebox image at the time it's created.
>
>This compiles OK, but crashes with this error:
>System.NullReferenceException: Object reference not set to an instance of an object.
>
>when I run it.
>
>Acecard is a resource that I can find with intellisense.
>
>
>
>Calling code:
> ChildForm1 formAce = new ChildForm1(global::UsingMDI.Properties.Resources.acecard);
>
>
>Class being called:
>
>public ChildForm1(Image objpictureboximage)
> {
> this.pictureBox1.Image = objpictureboximage;
> // set image to display in pictureBox
>
>
> InitializeComponent();
> }
>
>TIA
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform