Displaying a form as top, and modal, but without ShowDialog

  • Thread starter Thread starter Paul Aspinall
  • Start date Start date
P

Paul Aspinall

Can anyone advise how to display a form on top, and modal, without using
ShowDialog??

Thanks
 
Paul,

Why do you not want to use ShowDialog? If the form is modal, then I
don't see what the difference is.

What are you trying to do?
 
Hi

The reason is...
I have the user entering into a form, which must be modal (which I was using
ShowDialog to display), simila to a 'Wizard' style.

However, when the user makes an invalid entry, I want to display a
MessageBox, to inform them of a certain condtion....

this results in another modal form, being shown from a modal form......

When the user clicks 'OK' on the message, both 'modal' forms disappear, ie.
the message, and the 'wizard'.

Any ideas how to stop this?

Thanks


Nicholas Paldino said:
Paul,

Why do you not want to use ShowDialog? If the form is modal, then I
don't see what the difference is.

What are you trying to do?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Paul Aspinall said:
Can anyone advise how to display a form on top, and modal, without using
ShowDialog??

Thanks
 
Paul,

Can you show a piece of code that does this? I've whipped up a small
example, and tried to show a modal form, then a messagebox, and regardless
of whether or not I set the parent of the modal form or the dialog box, that
is not the behavior I get.

I think that there is something else going on.

If you could show an example, it would be helpful.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Paul Aspinall said:
Hi

The reason is...
I have the user entering into a form, which must be modal (which I was
using ShowDialog to display), simila to a 'Wizard' style.

However, when the user makes an invalid entry, I want to display a
MessageBox, to inform them of a certain condtion....

this results in another modal form, being shown from a modal form......

When the user clicks 'OK' on the message, both 'modal' forms disappear,
ie. the message, and the 'wizard'.

Any ideas how to stop this?

Thanks


Nicholas Paldino said:
Paul,

Why do you not want to use ShowDialog? If the form is modal, then I
don't see what the difference is.

What are you trying to do?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Paul Aspinall said:
Can anyone advise how to display a form on top, and modal, without using
ShowDialog??

Thanks
 
Paul,

I've recreated the example as an MDI app, which has one child form, and
then shows a modal dialog, and then shows a messagebox, and I don't get the
result that you do. I should note that I am running on .NET 2.0, so the
problem could have been fixed.

However, I would ask the following:

- When creating the MDI child form, are you setting the MdiParent property
to the MDI parent form (I assume yes on this one).
- When showing the modal dialog, are you passing the MDI child form as the
owner parameter in the call to ShowDialog?
- When calling the static Show method on the MessageBox, are you passing the
modal dialog as the owner parameter?

I have done all of the above, and could not reproduce the error.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Paul Aspinall said:
Hi

The reason is...
I have the user entering into a form, which must be modal (which I was
using ShowDialog to display), simila to a 'Wizard' style.

However, when the user makes an invalid entry, I want to display a
MessageBox, to inform them of a certain condtion....

this results in another modal form, being shown from a modal form......

When the user clicks 'OK' on the message, both 'modal' forms disappear,
ie. the message, and the 'wizard'.

Any ideas how to stop this?

Thanks


Nicholas Paldino said:
Paul,

Why do you not want to use ShowDialog? If the form is modal, then I
don't see what the difference is.

What are you trying to do?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Paul Aspinall said:
Can anyone advise how to display a form on top, and modal, without using
ShowDialog??

Thanks
 
Back
Top