Reyn
Member
- Joined
- Dec 11, 2008
- Messages
- 14
- Programming Experience
- 1-3
I am currently working on a text editor, and I seem to have an issue with the print preview control.
When I first run the program and then click on File -> Print Preview the dialog comes up fine. If I try to do so again an error comes up telling me that I cannot access a disposed object (the print preview dialog). However I am unaware of ever telling the program to dispose of it.
And It does not matter if I enter text into the text box, and when I do it, it still comes up with the error upon the second attempt at viewing the print preview.
I copied the code for this right out of a program I made to learn to print. Between that program and the one I am working on only the names of controls differs.
here is the code for the print preview control
When I first run the program and then click on File -> Print Preview the dialog comes up fine. If I try to do so again an error comes up telling me that I cannot access a disposed object (the print preview dialog). However I am unaware of ever telling the program to dispose of it.
And It does not matter if I enter text into the text box, and when I do it, it still comes up with the error upon the second attempt at viewing the print preview.
I copied the code for this right out of a program I made to learn to print. Between that program and the one I am working on only the names of controls differs.
here is the code for the print preview control
VB.NET:
Try
dlgPrintPreview.Show()
Catch ex As Exception
MessageBox.Show("An error has occured whil trying to show the print preview." & vbNewLine & _
"Detials: " & ex.Message, "SimpEdit Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Last edited: