473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Save/Open Drawn Image

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.
Nov 20 '05 #1
0 981

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: yaya via DotNetMonster.com | last post by:
Hi, I have a picture box with circles and rectangles, and I wana save all the images into a jpg file, i tried pictureBox1.Image.Save(@"c:\1.jpg"); but I got and error...
7
by: Martin | last post by:
I'm using the code show below (in VB.Net 2003) to create an image. I want to save this image to a .PNG file such that when I subsequently display it as part of a web page, the background of the...
3
by: Supra | last post by:
does ne 1 knows how to save picture? i'm using panel's control to viewed picture.
4
by: Yash | last post by:
Have used DrawLine() method to draw some lines in the picturebox (sort of a barcode) in the picturebox paint event. This diagram has to be saved as an image in bmp or tiff format. But the problem...
5
by: Dale | last post by:
When I create a System.Drawing.Bitmap and save it as ImageType.GIF, how can I set the transparency so that the background is transparent. In my application, the Bitmap that I am working with has...
12
by: Lee | last post by:
I have the following code using System; using System.Windows.Forms; using System.Drawing; using System.Collections; namespace FINN {
0
by: crazyyellowguy | last post by:
hi, This is my first post in this forum and I just wanted to thank you for even taking a look at my post. The class that I am writing the C code for is my first computer class and my knowledge is...
2
by: maifs | last post by:
hi..... can anybody tell me that how can i save my all application's work. mean that how can i save the images,circles,rectangle,lines or etl together.. if somebody knows it then plz explain me...
10
by: eddie tan | last post by:
Hi, I have a picturebox with graphics drawn from different objects. In one object I used Pen P1; P1 = new Pen(Color.Blue, 3); Graphics g = null; g = Graphics.FromImage(image.Image);...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.