|
-
Aug 12th, 2010, 01:33 PM
#1
Thread Starter
Addicted Member
Dialog Reuse?
Hi All,
I have a form that runs a foreach on a list. And during this I want each item in the list to show a dialog form (while running a background worker to run some changes). The problem is that I get the following error.
Cannot set Visibility or call Show or ShowDialog after window has closed.
What is the best method to get around this error? The dialog is basically a continuous progressbar that has text updated based on the background work being done. I want this because each item in the list will pace a value to the progressbar dialog form.
-
Aug 12th, 2010, 11:32 PM
#2
Re: Dialog Reuse?
Show us the code you're using.
-
Aug 12th, 2010, 11:39 PM
#3
Re: Dialog Reuse?
Hmmm... just did a quick test and apparently closing a WPF Window that was displayed using ShowDialog disposes it. The equivalent action in WinForms does not dispose the form, so that's a difference.
-
Aug 13th, 2010, 07:20 PM
#4
Re: Dialog Reuse?
 Originally Posted by jmcilhinney
Hmmm... just did a quick test and apparently closing a WPF Window that was displayed using ShowDialog disposes it. The equivalent action in WinForms does not dispose the form, so that's a difference.
Yeah that and also you cant actually dispose a WPF window - you just call Close and the garbage collector sorts it out. I think the fact that dialog forms dont stay open is a good thing because it never made sense to me for them to act any differently to when you show the form in non-dialog mode, but I dont like the fact that you cant manually dispose the window.
As for the OP's original problem - you must be showing the window and then closing it and then trying to show it again or something... this is all you should be doing:
Code:
Dim SomeWindow As New MainWindow
SomeWindow.ShowDialog()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|