Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie Question
Message
 
To
13/10/2008 10:15:58
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Environment versions
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01354574
Message ID:
01354580
Views:
23
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform