473,793 Members | 2,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RichTextBox hangs when being clicked on while periodically beingupdated by a background worker

Hi Group!

I have a simple GUI featuring a RichTextBox and a Button. On Button
click, I start a BackgroundWorke r that performs a query on the database
firing a ProgressChanged Event for every row. The corresponding event
handler appends the row to the RichTextBox.

This works quite fine, but if I click into the TextBox while the
BackgroundWorke r is running, the TextBox gets blank and the GUI hangs
until the BackgroundWorke r has finished. As soon as it has, the TextBox
is updated again correctly and everything is fine again. If I don't
click into the TextBox, it does update and display correctly.

There are no event handlers whatsoever attached to the TextBox.

Any ideas?

cheers

Mathias
Jan 22 '08 #1
1 1558
On Tue, 22 Jan 2008 04:19:18 -0800, Mathias Weyel <ne**@josquin.o rgwrote:
I have a simple GUI featuring a RichTextBox and a Button. On Button
click, I start a BackgroundWorke r that performs a query on the database
firing a ProgressChanged Event for every row. The corresponding event
handler appends the row to the RichTextBox.

This works quite fine, but if I click into the TextBox while the
BackgroundWorke r is running, the TextBox gets blank and the GUI hangs
until the BackgroundWorke r has finished.
It sounds as though in your button click handler, you are waiting for the
BackgroundWorke r to complete.

If you are, then don't do that.

If you're not, then you should post a concise-but-complete sample of code
that reliably reproduces the problem. There's no way for someone to help
you fix your implementation without knowing what the implementation is.

Pete
Jan 22 '08 #2

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

Similar topics

1
5336
by: john woo | last post by:
Hi I'm not good at JS, but want to get more about it. I want to use a JSP (the java code just used to get date, the rest are html and javascript), to display a table. the requirement is the all rows in even number in light-blue, rows in odd number in light gray, when a mouse clicks on a row, this row gets highlighted and in yellow, and it keeps highlighted
1
3952
by: Serge | last post by:
Hi, I am having some lock up problems in my c# code. when from a 2nd thread (worker thread) i call a normal standard function like Trace.WriteLine the 2nd thread freezes/hangs. The 2nd thread is started with a normal threadstart, etc. When looking on the internet I found some articles that hangs can be caused by unmanaged threads but I don't think I am doing this (am not using coms, .... )
5
4031
by: Serge | last post by:
Hi, I am having a thread hang problem in my c# code. The example on the website: http://csharp.web1000.com/ is a simplified version of my problem. You will see in the form that a method TestThread increments a number in the textbox on the form. TestThread is called from a worker thread (2nd thread) using a TimerThread.
2
3201
by: KenH | last post by:
I am getting an unhandled system exception while writing to a RichTextBox. The process may run for a few hours or days before the error is generated The message is "Cannot access a disposed object named RICHTEXTBOX." A check of the stack trace indicates the error is from the DLL that controls writing to the RTB. The form has not been closed and the line of code referenced is in a catch block that writes any error to this form's RTB (named...
3
4061
by: zbcong | last post by:
hello i put a richtextbox and a button on the winForm.when the button is clicked,it generate several threads to write to the richtextbox,the code snippet as following: private void btnSend_Click(object sender, System.EventArgs e) { for(int i=0;i<3;i++) { Thread thread =new Thread(new ThreadStart(rpt)); thread.Start();
6
2885
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a TimerState object similar to the example in the System.Threading.Timer documentation. The method which handles the timer events, among other things, periodically calls a method in this TimerState object which raises an event to the startup form,...
3
7601
by: David Cartwright | last post by:
Hi all, I'm having a weird time with a call to the Refresh() method of a DataGridView. I have a VB.NET 2005 Windows application with a main form and a "worker" thread. The main form delegates a Sub to the worker so that the latter can refresh the DataGrid after updating the DataTable driving it. When I run the app under the debugger, everything's fine. But when I run it for real, it hangs, apparently in the Refresh() method of the...
6
2101
by: Andreas Tawn | last post by:
I'm trying to integrate the timeout function from here http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473878 into a long running automation script and the following code causes IDLE after 20 or 30 iterations in countTest. This is in 2.5, XP and there's no traceback. Could someone point me at the user error? Thanks in advance.
1
1689
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I have a class that Form1 calls to do some work. I would like to report back progress from the class to a richtextbox, will call it m_report, on the form. Like in the class, Form1.m_report.Text= "Calculating variable 10"; How would I do that.
0
9670
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
10211
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
10159
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
10000
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9033
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
7538
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
5436
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
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
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

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.