An Error Message Come When Printing with OPOS Printer
-
Hello All, I am going to Print some File from my application. But I am facing some Problems. some times an error message is comming : --------------------------- SOTHER~1 --------------------------- Object is not connected to server --------------------------- OK --------------------------- but there is no problem in Printing, its working fine, but the message box is coming again when going to print next file. My Code is below : ---------------------- For i = 0 To files.Count - 1 Try POSEx = New PosExplorer PrintFileName = files.Item(i) fileData = My.Computer.FileSystem.GetFileInfo(PrintFileName) fileContents = My.Computer.FileSystem.ReadAllText(PrintFileName) If InStr(fileData.Name, ".") > 0 Then PrinterName = (fileData.Name).Split(".")(0) If PrinterName <> DupPrinterName Then SetDeviceVariable(PrinterName) End If DupPrinterName = PrinterName End If device = POSEx.GetDevice(DeviceType.PosPrinter, PrinterName) If Not device Is Nothing Then Printer = POSEx.CreateInstance(device) Printer.Open() Printer.Claim(1000) Printer.DeviceEnabled = True Printer.PrintNormal(2, fileContents) If bCutPaper = True Then Printer.CutPaper(0) End If Printer.DeviceEnabled = False Printer.Release() Printer.Close() System.IO.File.Delete(PrintFileName) End If Catch ex As PosControlException End Try Next Note: My Printing Function written in a separate Thread and it always searches is there any files in my application folder or not. So, How can I fixed this Prolem.
Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)
-
Hello All, I am going to Print some File from my application. But I am facing some Problems. some times an error message is comming : --------------------------- SOTHER~1 --------------------------- Object is not connected to server --------------------------- OK --------------------------- but there is no problem in Printing, its working fine, but the message box is coming again when going to print next file. My Code is below : ---------------------- For i = 0 To files.Count - 1 Try POSEx = New PosExplorer PrintFileName = files.Item(i) fileData = My.Computer.FileSystem.GetFileInfo(PrintFileName) fileContents = My.Computer.FileSystem.ReadAllText(PrintFileName) If InStr(fileData.Name, ".") > 0 Then PrinterName = (fileData.Name).Split(".")(0) If PrinterName <> DupPrinterName Then SetDeviceVariable(PrinterName) End If DupPrinterName = PrinterName End If device = POSEx.GetDevice(DeviceType.PosPrinter, PrinterName) If Not device Is Nothing Then Printer = POSEx.CreateInstance(device) Printer.Open() Printer.Claim(1000) Printer.DeviceEnabled = True Printer.PrintNormal(2, fileContents) If bCutPaper = True Then Printer.CutPaper(0) End If Printer.DeviceEnabled = False Printer.Release() Printer.Close() System.IO.File.Delete(PrintFileName) End If Catch ex As PosControlException End Try Next Note: My Printing Function written in a separate Thread and it always searches is there any files in my application folder or not. So, How can I fixed this Prolem.
Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)
Which line does the error occur on?? Since you're using a third party library (I've never heard of it), you're best source of information would be the manufacturer of that library.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Which line does the error occur on?? Since you're using a third party library (I've never heard of it), you're best source of information would be the manufacturer of that library.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Printer.Release() Printer.Close() Any of this line I am getting That error.
Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)
Guy, the best source of information you have on this is going to be the people who wrote that printer library you're using. I have no idea what it is, nor how it works, so there's very little I can tell you.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008