473,398 Members | 2,525 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,398 software developers and data experts.

Any way to cancel a dialog that's already called to showDialog?

Hi, I'm using vs2005, .net 2.0. I have a form with crystal Viewer that I
call as showdialog. I want to give the user an option to cancel out of it is
it's taking too long to process. Is there a way to do this? How can I pop
up another dialog box or message in this dialog form for user to click on a
Cancel button if it's taking to long to display the report?
--
Thanks.
Jan 2 '07 #1
5 1802
I'm not sure if this would work, but I would try making a public static
variable, and a timer with an interval of like... 20 seconds... and like,
start the timer in the line right before "ShowDialog()" for the crystal
viewer. Then after 20 seconds is passed (in the timer_Tick event method) I
would make it show a dialog box that says "This is taking long, would you
like to cancel?"

when the crystal viewer dialog is shown, I would make the variable equal to
like 1, so if the variable is not equal to 1 when 20 seconds has passed, I
would show the dialog saying that it is taking to long, and stop the timer.

if yes is clicked I would use e.cancel; somewhere.... I'm not sure where...

maybe that wouldnt even work.. just throwing it out there...

hope this helps.

"Pucca" wrote:
Hi, I'm using vs2005, .net 2.0. I have a form with crystal Viewer that I
call as showdialog. I want to give the user an option to cancel out of it is
it's taking too long to process. Is there a way to do this? How can I pop
up another dialog box or message in this dialog form for user to click on a
Cancel button if it's taking to long to display the report?
--
Thanks.
Jan 2 '07 #2
Hi
"roger_27" <ro*****@discussions.microsoft.comwrote in message
news:9D**********************************@microsof t.com...
I'm not sure if this would work, but I would try making a public static
variable, and a timer with an interval of like... 20 seconds... and like,
start the timer in the line right before "ShowDialog()" for the crystal
viewer. Then after 20 seconds is passed (in the timer_Tick event method)
I
would make it show a dialog box that says "This is taking long, would you
like to cancel?"
I do not think this will work, the timer just place an event in the windows
queue but as the form is busy generating the report it's basically blocked
to handle new messages.

honestly I do not see a clean solution to this. the main problem being that
the form will be blocked generating the report. so it will not handle any
event

OP:
Did you look into the archive and in the CR forums?

--
Ignacio Machin
machin AT laceupsolutions com
Jan 2 '07 #3
Hi Pucca,

the main problem is, to get the processing off the UI-Thread. Otherwise
there is no way to interrupt it.
Since it is the crystal Viewer, it might be impossible, if the control does
the processing in the UI-Thread.
If you put an Button on the Form. Can you click it (and process the
Click-event)? If so, it should be possible to close the form from that
event.

"Pucca" <Pu***@discussions.microsoft.comschrieb im Newsbeitrag
news:C7**********************************@microsof t.com...
Hi, I'm using vs2005, .net 2.0. I have a form with crystal Viewer that I
call as showdialog. I want to give the user an option to cancel out of it
is
it's taking too long to process. Is there a way to do this? How can I
pop
up another dialog box or message in this dialog form for user to click on
a
Cancel button if it's taking to long to display the report?
--
Thanks.

Jan 2 '07 #4
Is multi-threading possible way to do this? I haven't done that before but
if yes then I'll start digging information on how to do this using
multi-threading.
--
Thanks.
"Christof Nordiek" wrote:
Hi Pucca,

the main problem is, to get the processing off the UI-Thread. Otherwise
there is no way to interrupt it.
Since it is the crystal Viewer, it might be impossible, if the control does
the processing in the UI-Thread.
If you put an Button on the Form. Can you click it (and process the
Click-event)? If so, it should be possible to close the form from that
event.

"Pucca" <Pu***@discussions.microsoft.comschrieb im Newsbeitrag
news:C7**********************************@microsof t.com...
Hi, I'm using vs2005, .net 2.0. I have a form with crystal Viewer that I
call as showdialog. I want to give the user an option to cancel out of it
is
it's taking too long to process. Is there a way to do this? How can I
pop
up another dialog box or message in this dialog form for user to click on
a
Cancel button if it's taking to long to display the report?
--
Thanks.


Jan 3 '07 #5
Threading (displaying another form on a second UI thread) would allow
you to show a separate UI happily while this blocking UI renders
itself (so the user isn't completely blocked); however, the only real
managed way to close this blocking form is to ask the form to close
itself (thread affinity); to do that, you need to post a message to
the form's queue (Control.Invoke / Control.BeginInvoke). Unfortunately
if this form is truly blocking, then it won't be processing it's
queue, so it will never receive the request to close itself. There may
be some nastier Win32 ways of tearing this form down, but they won't
be pretty. I don't know much about crystal viewer, but have you tried
looking at the docs for ways of interrupting a long running query /
report?

Marc
Jan 3 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ray Mitchell | last post by:
Hello, I am opening a modal dialog in the standard way using something like: ....all the standard setup stuff... dlg.ShowDialog(); I need the dialog object to be able to access some of the...
3
by: Greg Horwood | last post by:
Dear Anyone, While most of you will laugh at the fundamental nature of my question, I am a bit stuck. I am a reasonable VC++ programmer trying to make the switch to C#. I am trying to create a...
13
by: Mike L | last post by:
I have a child form frmDataEntry call up another child form frmDealerSearch. If the user clicks on cancel on frmDealerSearch, I want to close frmDealerSearch and put the focus on txtDealerNum on...
2
by: jamie | last post by:
I have a class that based on a timer will pop up a dialog based on a lasped amount of time. The problem is that in the timer elapsed event I create and use ShowDialog to show the timeout form:...
10
by: GJP | last post by:
Hello. Ive been asked to make my own notepade for college assignment. All ig going well, but i cant get the save to work. I can get Save a (shows dialog box), i can get it to just save too,...
1
by: Jay | last post by:
I am new to coding so I am trying to learn. I have a save dialog box that I am able to get to work. I can save a file and all is good. My problem is when I hit cancel I am getting an error and I...
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....
3
by: AboutJAV | last post by:
Hi, I created a child dialog to tell the user that there is a loading of data from the database. When the loading is done, the child dialog will close. The child dialog contains a custom control...
8
by: Joe Duchtel | last post by:
Hello - I have the following code to detemine a file name when my application is saving a file. The problem is that if the file already exists and I select the Yes button in the "Do you want to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.