473,385 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 1574
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Paul Aspinall | last post by:
Can anyone advise how to display a form on top, and modal, without using ShowDialog?? Thanks
4
by: Strahimir Antoljak | last post by:
I keep an ArrayList in the external class. The external class is passed into a form via New constructor (see below). I process some data with functions within the form before showing the form. I...
4
by: Jm | last post by:
Hi all Im not sure of the best way to be displaying my forms and just want a bit of clarification. Being only recently moved to vb.net im still used to the old vb6 form.show method, now under...
6
by: Samuel R. Neff | last post by:
I'm having weird results with a form that is already displayed modally (via ShowDialog) displaying a second form via ShowDialog. The last form is not modal even though it's called with ShowDialog....
7
by: dgk | last post by:
I'm showing a form using ShowDialog (VB2003 in Visual Studio), and a button on that form pops up a FolderBrowserDialog. As soon as the FBD is closed, either by selecting or by cancel, the form...
8
by: WvH | last post by:
Hi, When I create a new application, with just one button, then this code works as expected: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
4
by: Chris Dunaway | last post by:
I have a main form with a "lock" button. When the lock button is clicked, another form is shown using ShowDialog(this). The user must enter their PIN on this form to close it and resume the main...
11
by: osmarjunior | last post by:
I have a sequence of commands like this: Form1 frm = new Form1(); frm.LoadData(); Boolean confirm = (frm.ShowDialog() == DialogResult.OK); The LoadData method loads information from...
1
by: Frank Rizzo | last post by:
I am not grokking the difference between Form.ShowDialog() and Form.ShowDialog(this). I have a form (parent form) that kicks off a modal dialog using Form.ShowDialog(). The modal dialog has a 3rd...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.