By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,592 Members | 1,931 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,592 IT Pros & Developers. It's quick & easy.

Modal Forms

P: n/a
Hi Everyone,

I am working in VB.NET, Framework v.1.0. I have tons of forms in my
application. I have a situation, where a form starts another form as a
Modal Dialog. The Modal Dialog then possibly starts another form as Modal
Dialog. Thus, if the main form is frmMain, and the other two forms are
frmOne and frmTwo, then frmMain calls frmOne.ShowDialog(me) and frmOne calls
frmTwo.ShowDialog(me).

My problem is that when frmTwo is closed or hidden, frmOne also closes or
hides. I would like to prevent this from happening. I tried setting the
forms TopMost. I tried using the SetWindowsPos API call to mess with the
Z-Order of the forms. I tried to just use the frm.Show() method and attempt
to emulate a Modal dialog with trickery. Nothing seems to quite accomplish
what I am trying to do. Can someone please help?

Thanks,

dmitry
Dec 10 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Dimitry,

I don't have v1.0 and all that I'm going to say is based on my test agains
1.1; hope it applies for 1.0.

1. In order not to get doalog boxes minimize together and to have the dialog
above its parent show the dialog like this

dlg.ShowDialog(this);

where *dlg* is reference to the dialog box form and *this* is reference to
the parent form (assuming) that the method where ShowDialog is called is
member of the parent form class.

2. As far as it goes for the problem with closing both forms when the top
one is closed it shouldn't happen. If you show the form when the user clicks
on a button check if the button has DialogResult property set. If it has it
will happen. Set the DailogResult of the button to *none*
--
HTH
Stoitcho Goutsev (100) [C# MVP]

--

Stoitcho Goutsev (100) [C# MVP]

"Dmitry Akselrod" <dm****@nospam.com> wrote in message
news:Wq******************************@comcast.com. ..
Hi Everyone,

I am working in VB.NET, Framework v.1.0. I have tons of forms in my
application. I have a situation, where a form starts another form as a
Modal Dialog. The Modal Dialog then possibly starts another form as Modal
Dialog. Thus, if the main form is frmMain, and the other two forms are
frmOne and frmTwo, then frmMain calls frmOne.ShowDialog(me) and frmOne
calls frmTwo.ShowDialog(me).

My problem is that when frmTwo is closed or hidden, frmOne also closes or
hides. I would like to prevent this from happening. I tried setting the
forms TopMost. I tried using the SetWindowsPos API call to mess with the
Z-Order of the forms. I tried to just use the frm.Show() method and
attempt to emulate a Modal dialog with trickery. Nothing seems to quite
accomplish what I am trying to do. Can someone please help?

Thanks,

dmitry

Dec 12 '05 #2

P: n/a
Please, don't "cross post".
--

Stoitcho Goutsev (100) [C# MVP]

"Dmitry Akselrod" <dm****@nospam.com> wrote in message
news:Wq******************************@comcast.com. ..
Hi Everyone,

I am working in VB.NET, Framework v.1.0. I have tons of forms in my
application. I have a situation, where a form starts another form as a
Modal Dialog. The Modal Dialog then possibly starts another form as Modal
Dialog. Thus, if the main form is frmMain, and the other two forms are
frmOne and frmTwo, then frmMain calls frmOne.ShowDialog(me) and frmOne
calls frmTwo.ShowDialog(me).

My problem is that when frmTwo is closed or hidden, frmOne also closes or
hides. I would like to prevent this from happening. I tried setting the
forms TopMost. I tried using the SetWindowsPos API call to mess with the
Z-Order of the forms. I tried to just use the frm.Show() method and
attempt to emulate a Modal dialog with trickery. Nothing seems to quite
accomplish what I am trying to do. Can someone please help?

Thanks,

dmitry

Dec 12 '05 #3

P: n/a

"Stoitcho Goutsev (100) [C# MVP]"
..
Please, don't "cross post".

Why not most people advice that in the dotNet newsgroups to *relevant*
groups instead of multipost?

I agree with you that the C# newsgroup is in this case almost completely
irrelevant.

For the rest, because that I tested the problem of the OP and had the same
problem as he, do I find it completely relevant as I see how many answers he
got. However because it is so od, I had expected more answers. Your first
one was one that was for me probably in the right direction (there is an old
bug in this area).

Cor

Stoitcho Goutsev (100) [C# MVP]

"Dmitry Akselrod" <dm****@nospam.com> wrote in message
news:Wq******************************@comcast.com. ..
Hi Everyone,

I am working in VB.NET, Framework v.1.0. I have tons of forms in my
application. I have a situation, where a form starts another form as a
Modal Dialog. The Modal Dialog then possibly starts another form as
Modal Dialog. Thus, if the main form is frmMain, and the other two
forms are frmOne and frmTwo, then frmMain calls frmOne.ShowDialog(me) and
frmOne calls frmTwo.ShowDialog(me).

My problem is that when frmTwo is closed or hidden, frmOne also closes or
hides. I would like to prevent this from happening. I tried setting the
forms TopMost. I tried using the SetWindowsPos API call to mess with the
Z-Order of the forms. I tried to just use the frm.Show() method and
attempt to emulate a Modal dialog with trickery. Nothing seems to quite
accomplish what I am trying to do. Can someone please help?

Thanks,

dmitry


Dec 12 '05 #4

P: n/a
Hi,

Your suggestion worked like a charm. I did something stupid and copied the
cancel button from another form. The cancel button had the DialogResult
property set.

Sorry about multiposting. I figured that my question was relevant to all
the groups.

Thanks again for your help!

dmitry

"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:uZ**************@TK2MSFTNGP12.phx.gbl...
Dimitry,

I don't have v1.0 and all that I'm going to say is based on my test agains
1.1; hope it applies for 1.0.

1. In order not to get doalog boxes minimize together and to have the
dialog above its parent show the dialog like this

dlg.ShowDialog(this);

where *dlg* is reference to the dialog box form and *this* is reference to
the parent form (assuming) that the method where ShowDialog is called is
member of the parent form class.

2. As far as it goes for the problem with closing both forms when the top
one is closed it shouldn't happen. If you show the form when the user
clicks on a button check if the button has DialogResult property set. If
it has it will happen. Set the DailogResult of the button to *none*
--
HTH
Stoitcho Goutsev (100) [C# MVP]

--

Stoitcho Goutsev (100) [C# MVP]

"Dmitry Akselrod" <dm****@nospam.com> wrote in message
news:Wq******************************@comcast.com. ..
Hi Everyone,

I am working in VB.NET, Framework v.1.0. I have tons of forms in my
application. I have a situation, where a form starts another form as a
Modal Dialog. The Modal Dialog then possibly starts another form as
Modal Dialog. Thus, if the main form is frmMain, and the other two
forms are frmOne and frmTwo, then frmMain calls frmOne.ShowDialog(me) and
frmOne calls frmTwo.ShowDialog(me).

My problem is that when frmTwo is closed or hidden, frmOne also closes or
hides. I would like to prevent this from happening. I tried setting the
forms TopMost. I tried using the SetWindowsPos API call to mess with the
Z-Order of the forms. I tried to just use the frm.Show() method and
attempt to emulate a Modal dialog with trickery. Nothing seems to quite
accomplish what I am trying to do. Can someone please help?

Thanks,

dmitry


Dec 13 '05 #5

P: n/a
Hi,

Your suggestion worked like a charm. I did something stupid and copied the
cancel button from another form. The cancel button had the DialogResult
property set.

Sorry about multiposting. I figured that my question was relevant to all
the groups.

Thanks again for your help!

dmitry

"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:uZ**************@TK2MSFTNGP12.phx.gbl...
Dimitry,

I don't have v1.0 and all that I'm going to say is based on my test agains
1.1; hope it applies for 1.0.

1. In order not to get doalog boxes minimize together and to have the
dialog above its parent show the dialog like this

dlg.ShowDialog(this);

where *dlg* is reference to the dialog box form and *this* is reference to
the parent form (assuming) that the method where ShowDialog is called is
member of the parent form class.

2. As far as it goes for the problem with closing both forms when the top
one is closed it shouldn't happen. If you show the form when the user
clicks on a button check if the button has DialogResult property set. If
it has it will happen. Set the DailogResult of the button to *none*
--
HTH
Stoitcho Goutsev (100) [C# MVP]

--

Stoitcho Goutsev (100) [C# MVP]

"Dmitry Akselrod" <dm****@nospam.com> wrote in message
news:Wq******************************@comcast.com. ..
Hi Everyone,

I am working in VB.NET, Framework v.1.0. I have tons of forms in my
application. I have a situation, where a form starts another form as a
Modal Dialog. The Modal Dialog then possibly starts another form as
Modal Dialog. Thus, if the main form is frmMain, and the other two
forms are frmOne and frmTwo, then frmMain calls frmOne.ShowDialog(me) and
frmOne calls frmTwo.ShowDialog(me).

My problem is that when frmTwo is closed or hidden, frmOne also closes or
hides. I would like to prevent this from happening. I tried setting the
forms TopMost. I tried using the SetWindowsPos API call to mess with the
Z-Order of the forms. I tried to just use the frm.Show() method and
attempt to emulate a Modal dialog with trickery. Nothing seems to quite
accomplish what I am trying to do. Can someone please help?

Thanks,

dmitry


Dec 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.