473,672 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1373
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
1850
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 boxes are visible but not the contents of the label. They become visible only after the button handler returns. If the dialog box is launched as dlg.ShowDialog() than everything is visible
2
1184
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
2967
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 entered. When this button is pressed and extract is prduced and IE's standard Open/Save dialog should popup so they can navigate to the directory to save the extract in, or if they want, they can choose to open and view the extract without saving it. ...
3
1317
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 on my machine and the Find and Replace Dialog Boxes do not appear. The documentation that came with my software "Microsoft Foundation Class Library Version 7.0" also lists CFindReplaceDialoge as part of the software package. I am using VB.net...
2
1039
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 styles are off. If they are on then the dialog box looks perfectly ok. I'm referring to the dialog boxes that come built into windows, not any that I create myself. The text does look ok on any of the forms that I made, it's just the dialog boxes...
4
9490
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 main form behind the dialog box is still enabled and can operate normally. If I use MessageBox.Show() to show a message box, the main form is disabled until the dialog box terminates. How can I make a custom dialog box do this?
0
1891
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 Installer class. This installer class inturn displays the custom dialog box i need. but the problem is this custom dialog box is displayed as a popup window during installation. But I want this custom dialog box to be shown as one of the wizard...
1
1316
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, undoubtedly some (or many) of the software's menus and dialog boxes change due to enhancements. This requires us to identify these changes (somehow) and re-do any screenshots in our documentation and training materials.
2
3204
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, instead of ok and cancel, i would like to replace them with (yes, i would like to go the path A and No, i would like to go in path B) 2. And when user clicks on either button it should close and another dialog box should pop open with another question...
1
1152
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 in zone alarm when applications want access to the internet, or print dialog boxes, and the shutdown menu in XP appears with massive font at the top. Amoungst others. I did change the font folder whilst creating a wedding invite, and there are...
0
8418
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8940
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8840
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8630
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7458
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6251
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4237
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2833
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1831
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.