Click here to Skip to main content
15,914,642 members
Home / Discussions / C#
   

C#

 
AnswerRe: Modeless dialog issue Pin
Luc Pattyn19-Apr-10 8:03
sitebuilderLuc Pattyn19-Apr-10 8:03 
GeneralRe: Modeless dialog issue Pin
aei_totten19-Apr-10 8:09
aei_totten19-Apr-10 8:09 
GeneralRe: Modeless dialog issue Pin
Richard Blythe19-Apr-10 9:59
Richard Blythe19-Apr-10 9:59 
GeneralRe: Modeless dialog issue Pin
aei_totten19-Apr-10 10:54
aei_totten19-Apr-10 10:54 
GeneralRe: Modeless dialog issue Pin
Richard Blythe19-Apr-10 11:25
Richard Blythe19-Apr-10 11:25 
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 3:09
aei_totten20-Apr-10 3:09 
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 3:50
aei_totten20-Apr-10 3:50 
AnswerRe: Modeless dialog issue Pin
Gregory Gadow19-Apr-10 11:05
Gregory Gadow19-Apr-10 11:05 
The difference between Show and ShowDialog is that the first method displays the form and continues with the next line of code, while the second method pauses execution of the code until after the form has been closed. Observe:
MyForm F = new MyForm();
F.ShowDialog();
System.Diagnostics.Debug.WriteLine("Output");


In this case, the string Output will not be written to the Immediate window until the pop-up form is closed. If you replace F.ShowDialog() with F.Show(), Output will probably be written before the form finishes rendering.

I suspect that your calling code needs to wait until the dialog has been handled, which is why ShowDialog works and Show does not. This can be a real pain if you are writing a MDI application, as child windows cannot be invoked with ShowDialog.


Added: After looking at the code you posted above, I can see the problem. After calling Show(), the method ends. The variable referencing your form goes out of scope and gets recycled: your form is not getting a chance to render before it gets disposed. If it absolutely has to be modeless, you will need to move the scope of your form's variable out.
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 2:11
aei_totten20-Apr-10 2:11 
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 3:33
aei_totten20-Apr-10 3:33 
GeneralRe: Modeless dialog issue Pin
Richard Blythe20-Apr-10 5:48
Richard Blythe20-Apr-10 5:48 
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 6:11
aei_totten20-Apr-10 6:11 
GeneralRe: Modeless dialog issue Pin
Richard Blythe20-Apr-10 7:10
Richard Blythe20-Apr-10 7:10 
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 7:31
aei_totten20-Apr-10 7:31 
GeneralRe: Modeless dialog issue Pin
Richard Blythe20-Apr-10 8:00
Richard Blythe20-Apr-10 8:00 
QuestionEject a remote computers CD rom Pin
Jacob Dixon19-Apr-10 7:46
Jacob Dixon19-Apr-10 7:46 
AnswerRe: Eject a remote computers CD rom Pin
Dave Kreskowiak19-Apr-10 10:29
mveDave Kreskowiak19-Apr-10 10:29 
GeneralRe: Eject a remote computers CD rom Pin
Jacob Dixon19-Apr-10 12:40
Jacob Dixon19-Apr-10 12:40 
GeneralRe: Eject a remote computers CD rom Pin
Luc Pattyn19-Apr-10 12:59
sitebuilderLuc Pattyn19-Apr-10 12:59 
GeneralRe: Eject a remote computers CD rom Pin
Dave Kreskowiak19-Apr-10 14:01
mveDave Kreskowiak19-Apr-10 14:01 
Questionwhy move using statement into namespace? [modified][Solved] Pin
yu-jian19-Apr-10 6:33
yu-jian19-Apr-10 6:33 
AnswerRe: why move using statement into namespace? [modified] Pin
dan!sh 19-Apr-10 6:56
professional dan!sh 19-Apr-10 6:56 
GeneralRe: why move using statement into namespace? Pin
PIEBALDconsult19-Apr-10 7:19
mvePIEBALDconsult19-Apr-10 7:19 
GeneralRe: why move using statement into namespace? Pin
yu-jian20-Apr-10 6:52
yu-jian20-Apr-10 6:52 
AnswerRe: why move using statement into namespace? Pin
Luc Pattyn19-Apr-10 7:00
sitebuilderLuc Pattyn19-Apr-10 7:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.