Jump to content
Xtreme .Net Talk

Recommended Posts

Guest Cheung
Posted

Hi all,

I encountered the following problem:

When I previewed/printed a document using the following code, it worked fine when my default printer is a laser printer. However, it threw an exception when my default printer was set to a dot matrix printer "Epson LQ-850". I used the following code:

 

Public Function PreviewFunction( ....... ) As Boolean

 

........................

 

myPrintDocu = New PrintDocument()

myPreviewDocu = New PrintPreviewDialog()

Try

AddHandler myPrintDocu.PrintPage, AddressOf PrintText

myPrintDocu.DefaultPageSettings = printPageSettings

myPreviewDocu.Document = myPrintDocu

msgbox(" it is now here!!!")

myPreviewDocu.ShowDialog()

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

End Function

 

public Function PrintText(ByVal sender As Object, ByVal e As PrintPageEventArgs)

msgbox("it is now inside PrintText")

.............................

 

End Function

 

When the printer was the dot matrix one and when the previewFunction was called, the message "it is now here!!!" was printed. After that, an exception was thrown and the msgbox in the PrintText function didn't reach.

If you know what happened, can you pls let me know.

 

Thank you.

Guest Cheung
Posted

wrong question...

 

I found that the problem was not due to the printers. It was due to the platforms. I wrote the program on NT. and when I ran this on a Win98 (of course with dotframework installed), the exception threw. any idea?

 

Thanks and Regards.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...