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

Dialog boxes and 2-way communication

I have a form which performs a task similar to a file copy in XP. I am
asked to display a progress in a pop-up box which would allow for the
task to be cancelled by the user. I've added the a form with a label
(for file info), progress bar and a cancel button.
I've made public functions to updated the status bar and the file name
label in the form, but using the [DialogBox].Show() method and calling
those update functions is very slow to respond. (Even using double
buffered dialog and refreshing the box upon update.)

Is there a good tutorial or some alternative suggestions which would
allow me to sample a two-way communication (send updates to the dialog
box for file names/progress and be able to cancel the main form's
process from the dialog?)

Thanks in advance.

Jul 6 '06 #1
1 1367
Hi Xlay,

Do your processing (file moving) in another thread. This leaves the graphical user interface to be fully responsive. The processing thread will need to update the progress bar (NB! Invoke/InvokeRequired) and check for a flag set by the user interface thread (lock) or handle the ThreadAbort exception depending on how you want to end the processing if the user cancels the operation.

If you are unfamiliar with multithreading, this can be a daunting task. A good place to start is reading Jon Skeet's article on multithreading

[Multi-threading in .NET]
http://www.yoda.arachsys.com/csharp/threads/

How to update a GUI thread from a processing thread

[Update windows forms from another thread]
http://blogs.msdn.com/ericgu/archive.../23/52502.aspx

I haven't studied this sample so I can't tell if it will help you out, but it does appear to do something similar to what you need

[Threading out tasks in a C#.NET GUI]
http://www.codeproject.com/csharp/csharp_guithreads.asp
--
Happy coding!
Morten Wennevik [C# MVP]
Jul 6 '06 #2

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

Similar topics

1
by: Laxmikant Rashinkar | last post by:
Hello, from inside a button handler, I am launching a dialog box that contains lables and text boxes. The dialog box is launched using dlg.Show(). In this situation the contents of the text...
2
by: JP | last post by:
Hi, Does dialog boxes that can minimize vertically exist in C#.NET? I have seen these boxes in e.g. paint shop pro and many linux user interfaces. Could anyone help? -jp
0
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they...
3
by: Tom McLaughlin | last post by:
I am having problems locating the "Find and Replace Dialog Boxes". My toolbox shows other Dialog Boxes. The Customize Toolbox dialog box displays a list of all .NET Framework components available...
2
by: Marco | last post by:
I have no idea what happened but for some odd reason the text in my dialog boxes isn't showing up. It's not just the message but also the text on the buttons. This only happens when the visual...
4
by: mpreston | last post by:
I'm following the example from the MSDN library on how to create modal dialog boxes in C#, but something isn't working properly. If I create a modal dialog box and show it using ShowDialog(), the...
0
by: Gancy | last post by:
Hi In my setup project I need a custom dialog box containing a drop down list box. Since this is not avaialble from standard user interface dialog boxes that visual studio supplies, I am using...
1
by: InfoDevGuy | last post by:
Hi: We are a software company. Our product (Dialogue) is very expansive with lots of menus, dialog boxes, etc in the GUI. We use unstructured FM 7.2. Every time we have a new release,...
2
by: one.1more | last post by:
I want to make a text game using javascript dialog boxes. i learned about confirm boxes but its not helpful(http:// www.javascriptmall.com/learn/lesson6.htm) 1. for ex, in the confirm boxes,...
1
by: =?Utf-8?B?QmVuIEM=?= | last post by:
I'm getting dialog boxes from a variety of applications appear very distorted. They are often extremely large covering all the screen whilst the main application appears normally. eg. This happens...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.