PC Review


Reply
Thread Tools Rate Thread

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

 
 
=?Utf-8?B?UHVjY2E=?=
Guest
Posts: n/a
 
      2nd Jan 2007
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.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?cm9nZXJfMjc=?=
Guest
Posts: n/a
 
      2nd Jan 2007
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.

 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      2nd Jan 2007
Hi
"roger_27" <(E-Mail Removed)> wrote in message
news:9D5D9D1F-F528-46A8-A63E-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Christof Nordiek
Guest
Posts: n/a
 
      2nd Jan 2007
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" <(E-Mail Removed)> schrieb im Newsbeitrag
news:C77974BE-DFB3-47BE-9547-(E-Mail Removed)...
> 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.



 
Reply With Quote
 
=?Utf-8?B?UHVjY2E=?=
Guest
Posts: n/a
 
      3rd Jan 2007
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" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:C77974BE-DFB3-47BE-9547-(E-Mail Removed)...
> > 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.

>
>
>

 
Reply With Quote
 
Marc Gravell
Guest
Posts: n/a
 
      3rd Jan 2007
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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SaveFileDialog.ShowDialog() returns Cancel when Yes to overwrite ... Joe Duchtel Microsoft VB .NET 7 5th Jun 2008 05:54 PM
Events fired when Form.ShowDialog is called =?Utf-8?B?RWRkaWUgTGFzY3U=?= Microsoft Dot NET Framework Forms 1 27th Nov 2006 09:33 PM
ShowDialog and Adverting Cancel button Matthew Microsoft C# .NET 1 2nd May 2006 04:39 AM
Is Close called when ShowDialog executes **Developer** Microsoft VB .NET 0 3rd Jan 2006 02:57 PM
PrintDialog.ShowDialog() instantly closes with CANCEL result Larry Brindise Microsoft Dot NET Framework Forms 9 26th Nov 2003 02:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:26 PM.