469,962 Members | 2,279 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,962 developers. It's quick & easy.

showdialog ; is there a property showing it?

3 forms.
form 1, when button clicked instantiates form 2 which opens but is not
shown. form 2 instantiates form 3 as showdialog. form 3 finishes, raises
an event that form 2 catches. during the catch, form 2 closes and disposes
the instance of form 3, opens itself as showdialog, and displays some data
to the user. the user can select one of these data and upon doing so raises
an event that form 1 catches (and closes and disposes of form 2). all is
good.

but following the same scenario, if after form 3 is closed and disposed and
form 2 uses me.showdialog. if the user doesn't like the data he can click a
button on form 2 and instantiate form 3 again. when that button is clicked,
form 2 calls me.hide because I can't close form2. problem is when form3 is
closing again, it raises an event which form2 catches, but that event wants
to call me.showdialog. at this point, i have called me.showdialog twice
which is no good.

so basically i want this

if me.<someproperty> = "IwasOpenedAsShowDialog" then
me.show
else
me.showdialog
endif

thanks
Nov 20 '05 #1
5 1453
Josh,

What holds you to use a shared swBool for that?
Mostly it makes things easier as well after 2 years when you read the
program again.

Just my thought about this?

Cor
Nov 20 '05 #2
i'm sorry cor, i am unable to follow what you wrote. can you try to explain
it again?

Cor Ligthert wrote:
Josh,

What holds you to use a shared swBool for that?
Mostly it makes things easier as well after 2 years when you read the
program again.

Just my thought about this?

Cor

Nov 20 '05 #3

"Josh Golden" <jo***@wachovia.com> wrote in message
news:40***********************@news.twtelecom.net. ..
i'm sorry cor, i am unable to follow what you wrote. can you try to explain it again?


I'm not a .NET expert, but I know when this question was asked in the VB6
groups our answer was "there is no easy way to tell if a window has been
shown modally." It's probably still the same with .NET.

I think Cor is suggesting that you track the status of the window yourself
with a Boolean variable that you set based on how you show the window. It's
your code, after all. Only you will be showing the form, so set this
variable at the same time to indicate HOW you showed the form. More work on
your part? Yes, a little. But it might be your only recourse.
Nov 20 '05 #4
Hi Josh,

Thinking about it, it is even simpler to set it as a public value in your
form.
Public swOpenAsDialog as boolean.
You can set that before you do the open.
Simple however very efficient.

Cor
Nov 20 '05 #5
* "Josh Golden" <jo***@wachovia.com> scripsit:
form 1, when button clicked instantiates form 2 which opens but is not
shown. form 2 instantiates form 3 as showdialog. form 3 finishes, raises
an event that form 2 catches. during the catch, form 2 closes and disposes
the instance of form 3, opens itself as showdialog, and displays some data
to the user. the user can select one of these data and upon doing so raises
an event that form 1 catches (and closes and disposes of form 2). all is
good.

but following the same scenario, if after form 3 is closed and disposed and
form 2 uses me.showdialog. if the user doesn't like the data he can click a
button on form 2 and instantiate form 3 again. when that button is clicked,
form 2 calls me.hide because I can't close form2. problem is when form3 is
closing again, it raises an event which form2 catches, but that event wants
to call me.showdialog. at this point, i have called me.showdialog twice
which is no good.

so basically i want this

if me.<someproperty> = "IwasOpenedAsShowDialog" then
me.show
else
me.showdialog
endif


If you are calling a form's 'Show' or 'ShowDialog' method twice on the
/same/ instance, the form will only be shown one time. What do you mean
by "which opens but is now shown"?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Strahimir Antoljak | last post: by
4 posts views Thread by Jm | last post: by
7 posts views Thread by dgk | last post: by
4 posts views Thread by Chris Dunaway | last post: by
1 post views Thread by Frank Rizzo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.