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

Cross-threading with backgroundworker - passing listview

hi!

i've been reading alot about the backgroundworker, but most of the articals
only shows that you can use the progress-event to send a message to the form.
Im trying to pass a listview with
a number of strings (in this case, strings of files and directorys).
i thought it could be done like this,

bwbackup.RunWorkerAsync(lvBackupStatus);
ListView lvibwc = (ListView) e.Argument;

but for some reason while running dowork I get a cross thread error.

Any tip taken, thanks!

-pixlor

Aug 1 '07 #1
2 4546
You should leave controls on UI thread to avoid issues like that one

Instead pass data for listview - you can use arrays, lists, tables, custom
tailored structures etc. For example, you can pass between threads arrays of
ListViewItem and additional values specifying how to show them. Just don't
touch UI control properties or methods in non-UI threads.

HTH
"cpix" <u36297@uwewrote in message news:760c1ce29ac05@uwe...
hi!

i've been reading alot about the backgroundworker, but most of the
articals
only shows that you can use the progress-event to send a message to the
form.
Im trying to pass a listview with
a number of strings (in this case, strings of files and directorys).
i thought it could be done like this,

bwbackup.RunWorkerAsync(lvBackupStatus);
ListView lvibwc = (ListView) e.Argument;

but for some reason while running dowork I get a cross thread error.

Any tip taken, thanks!

-pixlor

Aug 2 '07 #2
Thanks, arrays worked fine :)

- Eivind

AlexS wrote:
>You should leave controls on UI thread to avoid issues like that one

Instead pass data for listview - you can use arrays, lists, tables, custom
tailored structures etc. For example, you can pass between threads arrays of
ListViewItem and additional values specifying how to show them. Just don't
touch UI control properties or methods in non-UI threads.

HTH
>hi!
[quoted text clipped - 14 lines]
>>
-pixlor
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...neral/200708/1

Aug 3 '07 #3

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

Similar topics

0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
3
by: rollasoc | last post by:
Hi, Doing a bit of system testing on a Windows 98 laptop. (.Net 1.1 app). Did a bit of testing. Loaded a previously saved file. A gray box appeared with the text and buttons all white...
0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
23
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...
0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
1
by: Rob Woodworth | last post by:
Hi, I'm having serious problems getting my report to work. I need to generate a timesheet report which will contain info for one employee between certain dates (one week's worth of dates). I...
6
by: Simon | last post by:
Hi All, An experiment i'm doing requires requires a synchronous cross-domain request, without using a proxy. I wondered if anyone had any ideas to help me achieve this. Below is what I have...
6
by: Bart Van der Donck | last post by:
Hello, I'm presenting my new library 'AJAX Cross Domain' - a javascript extension that allows to perform cross-domain AJAX requests. http://www.ajax-cross-domain.com/ Any comments or...
6
by: ampo | last post by:
Hello. Can anyone help with cross-domain problem? I have HTML page from server1 that send xmlHTTPRequest to server2. How can I do it? Thanks.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.