Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
875
After Closing a printPreview, i cannot call it once more (disposed)
posted

I Print a UltraWingrid with ultragridPrintdocument und ultraprintPreview.

with

this

 

 

.ultraPrintPreviewDialog1.Show();

I call the Peview and all seems to be fine.

After Closing (with or without printing) I cannot call the Dialog once more. It seems to be disposed (Debugger: You cannot acces to a disposed object).

What's wrong?

Parents
  • 54937
    Suggested Answer
    Offline posted

    This is correct behavior. Whenever you close a modeless Form (it is modeless because you are calling Show and not ShowDialog) a Form will dispose itself. You would either need to show it modally (i.e. use ShowDialog - usually print preview dialogs are modal as they represent a snapshot of the state of an object at the time the preview was requested) or you would need to cancel the closing and hide the form (but then you might hit issues when you go to close your app because you'd be preventing that window from closing) or create a new instance of the printpreviewdialog in code every time you're going to show a new instance.

Reply Children
No Data