Show vs ShowDialog

L

Lloyd Sheen

I have a very strange problem. (VS 2008 SP1)

I have a form (dialog) which when I use the code

te.show(me) will show the dialog and it will stay.

If I use te.showdialog(me) there is a flash on the screen and the dialog is
gone.

I have put breakpoints in the form closing event etc but it never gets hit.
It does if I use the show.

LS
 
L

Lloyd Sheen

Lloyd Sheen said:
I have a very strange problem. (VS 2008 SP1)

I have a form (dialog) which when I use the code

te.show(me) will show the dialog and it will stay.

If I use te.showdialog(me) there is a flash on the screen and the dialog
is gone.

I have put breakpoints in the form closing event etc but it never gets
hit. It does if I use the show.

LS

Further to this, I closed VS opened and now it will catch the form closing.
The reason is NONE and the call stack shows External Code (don't you just
love that) and the ShowDialog.

?????

LS
 
L

Lloyd Sheen

Trevor Benedict said:
Check your Popup blocker(s) or add-ons.

Regards,

Trevor Benedict
MCSD

Thanks but how would a popup blocker stop a winforms program from showing a
new dialog. A popup blocker will only block new popups from your internet
browser.

LS
 
L

Lloyd Sheen

Trevor Benedict said:
Check your Popup blocker(s) or add-ons.

Regards,

Trevor Benedict
MCSD

Found out what it was. I was setting the dialog result to cancel as a
default in the load. It seems that as soon as I set that the dialog will
terminate.

LS
 
A

Armin Zingler

Lloyd said:
Further to this, I closed VS opened and now it will catch the form
closing. The reason is NONE and the call stack shows External Code
(don't you just love that) and the ShowDialog.

?????

Have you accidently set the DialogResult property of the Form in the Form
designer?


Armin
 
K

kimiraikkonen

I have a very strange problem.  (VS 2008 SP1)

I have a form (dialog) which when I use the code

te.show(me) will show the dialog and it will stay.

If I use te.showdialog(me) there is a flash on the screen and the dialog is
gone.

I have put breakpoints in the form closing event etc but it never gets hit.
It does if I use the show.

LS

Hi Lloyd,
First, it's interesting that Intellisense(on my VB 2005 Express
with .NET 2.0) doesn't show any parameter for ShowDialog, however
compilation is successful using Me keyword as parameter as owner.

And related to your problem, have you handled CloseReason of that form
in its FormClosing event handler?

' Assuming your form's name is "te"
' Place the code in that form(te)
Private Sub te_formclosing(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
' Handle CloseReason enum here, see reason
' in MessageBox

MsgBox(e.CloseReason.ToString)

End Sub


Hope this helps,

Onur Güzel
 
K

kimiraikkonen

Further to this, I closed VS opened and now it will catch the form closing.
The reason is NONE and the call stack shows External Code (don't you just
love that) and the ShowDialog.

?????

LS

Sorry, i missed that, my suggession was based on your post that you've
tried before.

Glad you found the solution.

Thanks,

Onur Güzel
 
T

Trevor Benedict

oops. Sorry about that. I was following the ASPNET forum before and misread
your post. I apologize.

Regards,

Trevor Benedict
MCSD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top