Hi,
I have a picturebox on a form that I am able to draw on (similar to ms
paint). My declarations are as follows:
--------------------------------------------------------------------------------
'Globals
Dim b As Drawing.Bitmap ' Eventually initialzed to b = New
Drawing.Bitmap(Me.Width, Me.Height)
Dim g As Drawing.Graphics
Dim pen As New Drawing.Pen(System.Drawing.Color.DarkBlue, 2)
Dim aBgColor As Drawing.Color = Drawing.Color.White
--------------------------------------------------------------------------------
I can sucessfully save the Image using the following code:
--------------------------------------------------------------------------------
Public Sub SaveSigAsImage(ByVal Path As String)
b.Save(Path)
End Sub
--------------------------------------------------------------------------------
I can sucessfully open the image right when the program starts with
the following code:
--------------------------------------------------------------------------------
Public Sub OpenSigImage(ByVal Path As String)
picSig.Image = Image.FromFile(Path)
b = picSig.Image
End Sub
--------------------------------------------------------------------------------
The problem is, when I open an image, modify it and save it, an
exception is thrown: An unhandled exception of type
'System.NullReferenceException' occurred in WindowsApplication3.exe
Additional information: Object reference not set to an instance of an
object.
The exception is thrown on the line b = picSig.Image in OpenSigImage.
How do I initialize b when opening the picture?
Thank you.