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

MDI Child as Thread

Hi,
i am doing a db update in an mdi child and for the process of the update
(several minutes) the child freezes the entire screen.

could someone help me to on how to run an mdi i child as a thread ? I
suppose thats the way to do it.

I want the to prevent that the form is freezing the entire application
and screen and also want to work on other forms while the update is in
progress.

Thanks a lot for any suggestion and help

Alex

Nov 20 '05 #1
4 2112
Hi Alex,

You wouldn't run an Mdi child as a thread per se. What you would do is run
the db update within a Thread. This makes your question much simpler because
you can forget the Mdi bit.

There's plenty of documentation on MSDN for Threads. I posted a Threading
example to someone only tonight. It might be more than you need but then
again, it might be useful. ;-)

Topic: New to threading.. Please help.., dated 21st Oct.

Come back with any further questions.

Regards,
Fergus
Nov 20 '05 #2
Hi Fergus,
thanks a lot
Alex

Fergus Cooney wrote:
Hi Alex,

You wouldn't run an Mdi child as a thread per se. What you would do is run
the db update within a Thread. This makes your question much simpler because
you can forget the Mdi bit.

There's plenty of documentation on MSDN for Threads. I posted a Threading
example to someone only tonight. It might be more than you need but then
again, it might be useful. ;-)

Topic: New to threading.. Please help.., dated 21st Oct.

Come back with any further questions.

Regards,
Fergus


Nov 20 '05 #3
Fergus,
I am not quite sure if i understand you correctly...
an MDI form in my application has a distinctive task. I have build
another class that handles various table updates/manipulation. like
getTable, updateTable etc.

Here is what I need to do.
1. I want to start the update
2. I want to show a progress bar
3. I want to prevent users from changing the form untill the update is
completed.
4. While running the update the user should be able to do different things.

Now, if I run the a thread per db connection then i blieve the user can
still manipulate the form. Though this could be done for the form
waiting to complete... but then what is the difference in running the
form as a thread.

Sorry, guess I am too new for that topic. Am just a bit frustrated that
the gui freezes for 10 min.

Alex

Fergus Cooney wrote:
Hi Alex,

You wouldn't run an Mdi child as a thread per se. What you would do is run
the db update within a Thread. This makes your question much simpler because
you can forget the Mdi bit.

There's plenty of documentation on MSDN for Threads. I posted a Threading
example to someone only tonight. It might be more than you need but then
again, it might be useful. ;-)

Topic: New to threading.. Please help.., dated 21st Oct.

Come back with any further questions.

Regards,
Fergus


Nov 20 '05 #4
"alex" <ai******@hotmail.com> schrieb
Fergus,
I am not quite sure if i understand you correctly...
an MDI form in my application has a distinctive task. I have build
another class that handles various table updates/manipulation. like

getTable, updateTable etc.

Here is what I need to do.
1. I want to start the update
2. I want to show a progress bar
3. I want to prevent users from changing the form untill the update
is
completed.
4. While running the update the user should be able to do different
things.

Now, if I run the a thread per db connection then i blieve the user
can still manipulate the form. Though this could be done for the
form waiting to complete... but then what is the difference in
running the form as a thread.

Sorry, guess I am too new for that topic. Am just a bit frustrated
that the gui freezes for 10 min.


If you put the work in a different thread, the GUI does not freeze. I'd put
the work in a separate class (a kind of worker/thread class) and raise
abstract events (DoneThis, DoneThat, Progress...). The UI can catch the
events. As the event handlers in the UI also run in the other thread, i.e.
not in the thread that created the UI/Form, you have to marshal the UI
update to the thread that created the Form by calling Invoke/BeginInvoke.

Of course, your UI and the rest of the application has to take care of the
fact that there is something running in the background and you may come
across conflicts or inconsistences. You have to deal with them - the answer
how to do it is very individual. An MDI environment might be the worst
scenario - so modally showing a (responsive) Form containing a progressbar
and a cancel button is probably the easiest solution.
--
Armin

Nov 20 '05 #5

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

Similar topics

1
by: jinu | last post by:
Hello, My application loads with a form which is the mdi parent and a menu item click (main menu of the parent form) brings up a child form. I have to wait for a considerable amout of time to...
10
by: Barbara Alderton | last post by:
I am working with SharePoint 2003. I am using (using C#) an existing webpart as a child control (server control). I need to access/manipulate the HTML that the control outputs prior to rendering...
4
by: Bonj | last post by:
Further to my last post, I have managed to get a child window to display. But its messages are routed to the same WNDPROC that the main window's messages are routed to - what is the way of...
3
by: Vinicius Bellino | last post by:
Hi All, Is there a way to change a property of an UI control, such as the enabled property of a button, in a child thread? I mean, my code runs a long process, and because I wanted to show the...
6
by: Dinesh Jain | last post by:
Hi all, How to inform Parent thread from a Child Thread? I mean want to notify something from Child thread to Parent Thread. Please help, Thanks in advance, -Regards, Dinesh
2
by: Chen Houwu | last post by:
------------------sample code begin------------------------- import threading import wmi def run(*args): c = wmi.WMI () memory=c.Win32_LogicalMemoryConfiguration() info='Total Virtual...
2
by: sunil | last post by:
Hi All, I am tring to debug the following program.I written this program in HP-Unix and I am using the GDB as a debugger. #include <stdio.h> #include<unistd.h> int main() { int pid; pid =...
6
by: foolmelon | last post by:
If a childThread is in the middle of a catch block and handling an exception caught, the main thread calls childThread.Abort(). At that time a ThreadAbortException is thrown in the childThread. ...
1
by: james_w77 | last post by:
I am trying to use Peter's StoppableThread(threading.Thread). What I want to do is to start 5 child threads, then do something, then when got ^C keyboard exception, stop the child thread. For...
2
by: =?Utf-8?B?a2VubmV0aG1Abm9zcGFtLm5vc3BhbQ==?= | last post by:
vs2005, c# Trying to understand why one way works but the other doesnt. I have not tried to create a simpler mdi/child/showdialog app for posting purposes (I think even this would not be so small...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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.