Cum Grano Salis

Resolution: ShowDialog() after ShowDialog().

So.. What can I say? Copy & Paste owned my hiney.

In my previous post, I was bewildered by a behavior I've been seeing where a Dialog box opened from another dialog box would cause the first dialog box to close.

Well, this is partly because of Copy & Paste and partly because I am a moron. When designing forms, I usually copy & paste buttons around since it's the easiest way of having the same exact size for all of them (what can I say, I am lazy). This has the obvious effect of causing all the properties to be copied over. Including the DialogResult property (duh). So I ended up with a bunch of buttons that would close the dialog. So, as (almost) always, .NET is doing exactly what I am asking it to do.

This also explains the fact that when I searched for this behavior, some people were reporting it and others were unable to repro it. It also explains why it only happens "sometimes". Lesson learnt.

Published Monday, October 10, 2005 1:25 PM by Shahar
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

uLavidian said:

Man... thanks for the post, it helped me heaps... to imagine... hmmm haha

September 27, 2007 2:02 AM

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Submit

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker