473,413 Members | 1,705 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,413 software developers and data experts.

aborting thread results in application crash

Hello,

I'm using threads to fill a form with multiple controls: In a
listbox.selecteditem_changed, I abort the current thread, and I start a
new thread to fill the form with the data correspondent to the selected
Item. The reason for using threads here is speed (since the filling of
the form takes +/- 0.5 sec). But if I rapidly select some different
items in the listbox (e.g. with the arrow buttons), the application
stops executing, and crashes (CPU-time=100% and not responding). There
doesn't seem to be a critical line of code, it just stops at different
lines... Does anyone knows what the reason is for this ? Here's the code:

private sub lst_selectedindexchanged(...) handles ...
try
thread.abort 'thread is declared private in
'the form class
catch exc as exception
end try
thread=new threading.thread(AddressOf fillForm)
thread.start()
end sub

private sub FillForm()
'here i do stuff like: filling a Combobox,
'setting text for a textbox, ...
end sub
Thanks,

Snuyt
Nov 21 '05 #1
1 1623
Changing properties of controls not beeing created on the same thread
can lead to these sort of problems.
Use control.invoke to change the properties.

Tosch
On Mon, 01 Nov 2004 18:55:02 +0100, Snuyt <us**@example.net> wrote:
Hello,

I'm using threads to fill a form with multiple controls: In a
listbox.selecteditem_changed, I abort the current thread, and I start a
new thread to fill the form with the data correspondent to the selected
Item. The reason for using threads here is speed (since the filling of
the form takes +/- 0.5 sec). But if I rapidly select some different
items in the listbox (e.g. with the arrow buttons), the application
stops executing, and crashes (CPU-time=100% and not responding). There
doesn't seem to be a critical line of code, it just stops at different
lines... Does anyone knows what the reason is for this ? Here's the code:

private sub lst_selectedindexchanged(...) handles ...
try
thread.abort 'thread is declared private in
'the form class
catch exc as exception
end try
thread=new threading.thread(AddressOf fillForm)
thread.start()
end sub

private sub FillForm()
'here i do stuff like: filling a Combobox,
'setting text for a textbox, ...
end sub
Thanks,

Snuyt


Nov 21 '05 #2

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

Similar topics

8
by: Ola Natvig | last post by:
Anybody out there who knows if the 4suite implementation of XSLT are a threadsafe one? -- -------------------------------------- Ola Natvig <ola.natvig@infosense.no> infoSense AS / development
1
by: johnny | last post by:
In a multi-threaded application, say a worker thread makes an asynchronous call and specifies a callback method. But before the callback is executed, the thread is aborted by its creator. What is...
3
by: Keyee Hsu | last post by:
Hi, I have a C# app that creates an AppDomain, enters it, and spawns an asyn thread to do some work and then block itself. Upon the completion of the work, the async thread supposedly terminates,...
13
by: Paul | last post by:
Hi, How do I wait until a thread is finished his job then continue to the original thread? public void main(string args) { Thread t = new Thread(new ThreadStart(DoWork)); t.Start();
3
by: Jeff Greenland | last post by:
Hello everyone, I am having problems with Timers in a web application. They just seem to stop running after 15 minutes or so. My web application is set up like this: When a user hits a...
22
by: nd02tsk | last post by:
Hello! I have a couple of final ( I hope, for your sake ) questions regarding PostgreSQL. I understand PostgreSQL uses processes rather than threads. I found this statement in the archives: ...
7
by: archana | last post by:
Hi all, I am having application in which i am doing asynchronous call.I am using manualresetevent to wait for asynchronous call to complete. I want to stop asynchronous call after certain...
4
by: Mufasa | last post by:
Is there any way to force a thread to abort and really have it abort? I have a thread that every once in a while gets hung to so I kill it. Problem is I have a thread that every once in a while...
3
by: AdrianDev | last post by:
Hi, I have a thread which I call like this: // Allocate a new thread containing class with the host getInfoThread git = new getInfoThread(host); // Create the thread and call the Go method...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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,...
0
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...
0
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...

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.