Ryan Foy
Ryan Foy

Reputation: 322

Adding an image in a picture box Windows Form

I created a windows form to display text in a richtext and then added a picture box to add some color to it. at the moment when I load up the form it looks like this:

Version Windows Form

The dot above the rich text is the location of were I added the picture box, at the moment when I try to add an image to picture box it gives me an error: Value cannot be null. Parameter name: docData. I get this error by going to the properties of the picture box and to Image witch is labled (none) at the moment.

How do I fix this problem that I am having. (I use C# 2010 Express, XNA Game Studio 4.0, Windows Game(4.0))

Upvotes: 0

Views: 5293

Answers (1)

gnarlybracket
gnarlybracket

Reputation: 1720

This seems to be a Windows Game (4.0) issue. See the answer on this page. You could try to set the image in your code like this:

pictureBox1.Image = Image.FromFile("path/somefile.jpg");

According to this page, this problem is a bug that hasn't been fixed.

Upvotes: 3

Related Questions