473,892 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Chaging a UI control in a child thread

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
status in another popup window, I created a new (child) thread to run
the long process and I let the main thread open a new popup with
auto-refresh to show the status, using a shared Session variable to
pass the current status between these threads. Before starting the
long process, the main thread sets some UI controls to disabled, after
this process finishes in the child thread, I'd like to enable these
controls again. How could I do it?

Thanks in advance,

Vinicius
Nov 19 '05 #1
3 1898
"Vinicius Bellino" <vb******@uol.c om.br> wrote in message
news:93******** *************** **@posting.goog le.com...
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
status in another popup window, I created a new (child) thread to run
the long process and I let the main thread open a new popup with
auto-refresh to show the status, using a shared Session variable to
pass the current status between these threads. Before starting the
long process, the main thread sets some UI controls to disabled, after
this process finishes in the child thread, I'd like to enable these
controls again. How could I do it?


You can't have a child thread touch the original Page or Request. As soon as
the Page finishes rendering, the Page, Request, Response, Context, etc.
objects are destroyed. Your child thread is then left playing with garbage.
Consider some of the following:

Indicating Progress
http://msdn.microsoft.com/library/de...pplication.asp

Make a Progress Indicator For Slow-Loading Pages
(http://www.aspnetpro.com/NewsletterA...200308bm_l.asp)
DESIGN PATTERNS: Asynchronous Wait State Pattern in ASP.NET
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

John Saunders
Nov 19 '05 #2
when the popup window detects done, have client script in the popup update
the main page.

"Vinicius Bellino" <vb******@uol.c om.br> wrote in message
news:93******** *************** **@posting.goog le.com...
| 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
| status in another popup window, I created a new (child) thread to run
| the long process and I let the main thread open a new popup with
| auto-refresh to show the status, using a shared Session variable to
| pass the current status between these threads. Before starting the
| long process, the main thread sets some UI controls to disabled, after
| this process finishes in the child thread, I'd like to enable these
| controls again. How could I do it?
|
| Thanks in advance,
|
| Vinicius
Nov 19 '05 #3
I just submit the parent window and it worked fine!
John, thanks for the links anyway, they're helpful!

Vinicius Bellino

Nov 19 '05 #4

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

Similar topics

1
1624
by: Srikanth Mandava | last post by:
Hi! When a signal handler is registered in the main thread and "control-c" is entered, the child thread is getting the KeyboardInterrupt exception(The documentation says the main thread MUST receive the signal handler function call if handler is registered). In python 2.2.1 the main thread was always called with the sigint signal handler which was registered. In my case the
23
6557
by: Jeff Rodriguez | last post by:
Here's what I want do: Have a main daemon which starts up several threads in a Boss-Queue structure. From those threads, I want them all to sit and watch a queue. Once an entry goes into the queue, grab it and run a system command. Now I want to make sure that system command doesn't hang forever, so I need some way to kill the command and have the worker thread go back to work waiting for another queue entry.
2
1859
by: frederik12 | last post by:
Hi all, Today I downloaded and installed VS 2005 C# Express Edition (.NET framework 2.0). I'm very pleased about this new product. In my current application I'm using the WebBrowser control in a child form. Two questions: 1) Does the user need IE to get this control working? 2) I cancel the closing of the child form in it's FormClosing event and
10
2372
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a top border. Is it possible to have more than 1 style at the same level (parent node) when using a SiteMap? I want it to appear something like this and I can only find a way to either have the border on all root nodes or none at all. In...
5
2347
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a problem in this scenario: <myprefix:mycontrol runat="server"> <%= SomeVariable %> </myprefix:mycontrol>
15
6547
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
5
3284
by: Peted | last post by:
Just some threading questions 1. in a MDI app if you have multiple child forms, does each child form run in its own thread ? Eg do you get error trying to update one control on form1 from form 2 2. if you have a timer control running on a childform, and you either a. minimize or
2
4431
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 or simple). I am hoping the description will generate some ideas I can check out. PROBLEM: ----------------- Switching to UI thread using Invoke(), everything seems good.
3
3726
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I using BackgroundWorker control in my Windows Forms. In my form, I have a SplitterPanel. In DoWork event , I create controls child, and in ProgressChanged event I try add controls to SplitterPanel, but the application not responds. I use InvokeRequired for controls child. Any suggestions, please ?
0
9981
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11241
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...
1
10926
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,...
1
8018
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
7172
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5857
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...
0
6065
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4683
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
4279
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.