Have you tried enclosing your call to Dispose in a finally block?
And also, have you tried setting the PrintPreviewDialog object to null
("nothing" in vb) ?Here's an example you might want to try: http://benjnunez.pastebin.com/N3cVJmJ7 Regards, Benj On Nov 10, 5:52 pm, Danny Bosschaerts <[email protected]> wrote: > When calling up a PrintPreviewDialog that fails because the printer is > invald, a nice error is given in the catch-blok. > But, when the same call is redone, the error states that it isn't > possible to show a modal dialog when another is still active. > > Try > PrintPreviewDialog.ShowDialog() > Catch ex As Exception > MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Selected > printer issue") > End Try > > (this normal error after 1st call) > --------------------------- > Selected printer issue > --------------------------- > Settings to access printer 'HP LaserJet 3390 / 3392 PCL5' are not > valid. > --------------------------- > OK > --------------------------- > > (this error after 2nd call) > --------------------------- > Selected printer issue > --------------------------- > Form that is already displayed modally cannot be displayed as a modal > dialog box. Close the form before calling showDialog. > --------------------------- > OK > --------------------------- > > Tried in then Catch-block PrintPreviewDialog.Document = > Nothing, .Close, .Dispose, ... > Closing the form where the PrintPreviewDialog-object resides on and > reopenning it, does the job. > Can't find out what is hanging around. > > Thanks,
