I am using a PrintDocument and PrintDialog to print. The first time that I
print it works, but when I try to print a second time without exiting the
entire program I get an "InvalidPrinter Exception was unhandled" error. The
error happens in the third line below. The details of the error are below
my signature. Help?
PrintDialog1.Pr interSettings.P rinterName = sLabelPrinterDe viceName
PrintDialog1.Do cument = PrintDocument1
PrintDialog1.Do cument.Print() ' the error happens in this line
Any ideas?
--
Rick Lederman
Soaring Software Solutions, Inc.
www.soaringsoftware.com
ri**@soaringsof tware.com
System.Drawing. Printing.Invali dPrinterExcepti on was unhandled
Message="Settin gs to access printer 'Samsung ML-2250 Series (Copy 1)' are
not valid."
Source="System. Drawing"
StackTrace:
at System.Drawing. Printing.Printe rSettings.GetHd evmodeInternal( )
at System.Drawing. Printing.Printe rSettings.GetHd evmode(PageSett ings
pageSettings)
at System.Drawing. Printing.PrintC ontroller.OnSta rtPrint(PrintDo cument
document, PrintEventArgs e)
at
System.Windows. Forms.PrintCont rollerWithStatu sDialog.OnStart Print(PrintDocu ment
document, PrintEventArgs e)
at System.Drawing. Printing.PrintC ontroller.Print (PrintDocument
document)
at System.Drawing. Printing.PrintD ocument.Print()
at TCMaxLabelMaker .frmMain.cmdPri ntSequence_Clic k(Object sender,
EventArgs e) in C:\VS2005\Copy (15) of
TCMaxLabelMaker \TCMaxLabelMake r\frmMain.vb:li ne 4932
at System.Windows. Forms.Control.O nClick(EventArg s e)
at System.Windows. Forms.Button.On Click(EventArgs e)
at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage&
m)
at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G&
msg)
at
System.Windows. Forms.Applicati on.ComponentMan ager.System.Win dows.Forms.Unsa feNativeMethods .IMsoComponentM anager.FPushMes sageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.Applicati on.Run(Applicat ionContext context)
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.OnRun ()
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.DoApp licationModel()
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.Run(S tring[]
commandLine)
at TCMaxLabelMaker .My.MyApplicati on.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.v b:line 81
at System.AppDomai n.nExecuteAssem bly(Assembly assembly, String[]
args)
at System.Runtime. Hosting.Manifes tRunner.Run(Boo lean checkAptModel)
at System.Runtime. Hosting.Manifes tRunner.Execute AsAssembly()
at
System.Runtime. Hosting.Applica tionActivator.C reateInstance(A ctivationContex t
activationConte xt, String[] activationCusto mData)
at
System.Runtime. Hosting.Applica tionActivator.C reateInstance(A ctivationContex t
activationConte xt)
at
Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem blyDebugInZone( )
at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
at System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
at System.Threadin g.ThreadHelper. ThreadStart()