What the ****, memorystream question.
Here is my code, the Pos1 - Pos6 objects are Pictureboxes. They all contain pictures that I want to send to a dataset, before I can do that I have to save them to memorystream variables...
When I run this code I get the following error...
An unhandled exception of type 'System.ArgumentNullException' occurred in system.drawing.dll
Additional information: Value cannot be null.
I don't know what to do because the value of the pictureboxes is definately not null. I can verfiy that through the command window in debug mode. It tells me that it is a valid bitmap object. Any advice would be much appreciated.
Code:
Dim Image1 As IO.MemoryStream
Dim Image2 As IO.MemoryStream
Dim Image3 As IO.MemoryStream
Dim Image4 As IO.MemoryStream
Dim Image5 As IO.MemoryStream
Dim Image6 As IO.MemoryStream
Pos1.Image.Save(Image1, System.Drawing.Imaging.ImageFormat.Bmp)
Pos2.Image.Save(Image2, System.Drawing.Imaging.ImageFormat.Bmp)
Pos3.Image.Save(Image3, System.Drawing.Imaging.ImageFormat.Bmp)
Pos4.Image.Save(Image4, System.Drawing.Imaging.ImageFormat.Bmp)
Pos5.Image.Save(Image5, System.Drawing.Imaging.ImageFormat.Bmp)
Pos6.Image.Save(Image6, System.Drawing.Imaging.ImageFormat.Bmp)