I want to show a modal dialog box at a moment when I don't know which form
of my application is focused, so I can't call ShowDialog(owner). Keeping
current form in a global variable would be troublesome. Other ideas?
Sijin Joseph - 05 Sep 2004 05:43 GMT
Hi Lukasz,
The best solution currently for you would be to maintain a global list
of openforms. And when you want to call Showdialog loop through the
forms checking which one has focus.
Quite cumbersome approach i know. But it seems we will have to wait till
VB.Net 2005 to use My.Appliaction.OpenForms, until then i guess we will
have to roll our own.
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
> I want to show a modal dialog box at a moment when I don't know which form
> of my application is focused, so I can't call ShowDialog(owner). Keeping
> current form in a global variable would be troublesome. Other ideas?
Herfried K. Wagner [MVP] - 05 Sep 2004 12:18 GMT
* "lukasz" <bbla32@op.pl> scripsit:
> I want to show a modal dialog box at a moment when I don't know which form
> of my application is focused, so I can't call ShowDialog(owner). Keeping
> current form in a global variable would be troublesome. Other ideas?
Simply don't pass an owner to the 'ShowDialog' method...

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/
lukasz - 05 Sep 2004 16:32 GMT
hah.. I wasn't aware of the parameterless version of the method. According
to the specs it's what I wanted -- thanks.
> * "lukasz" <bbla32@op.pl> scripsit:
> > I want to show a modal dialog box at a moment when I don't know which form
> > of my application is focused, so I can't call ShowDialog(owner). Keeping
> > current form in a global variable would be troublesome. Other ideas?
>
> Simply don't pass an owner to the 'ShowDialog' method...