By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,888 Members | 1,465 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,888 IT Pros & Developers. It's quick & easy.

adding controls from a different thread

P: n/a
Hi folks,

I have a form in which I'm starting a separate thread (which is searching
directories for image-files and generating thumbnails of them in different
dir). Within the form, I also have a FileSystemWatcher, which will trigger
as soon as a thumbnail is generated from that thread. When triggered, the
thumbnail-image that has just been found is to be displayed in a
"Panel-UserControl" (consisting of a panel and a couple of other controls).
The Panel-UserControl itself will add one Item-UserControl (consisting of a
picturebox and a couple of other controls) for each thumbnail to be
displayed - and that's where everything goes boom:
The FSW's creation-trigger (have tried the trigger-function residing both
in the form and the Panel-UserControl) will call the Panel-UserControl's
AddThumbnail-function which in turn will create a new Item-UserControl in
which that image is to be displayed. But as soon as I'm issuing a
"Panel.Controls.Add ItemControl" or a "ItemControl.Parent=PanelControl",
I'll get the exception ~"controls created on one thread cannot be parented
to another thread".

If it's just not possible (at least I didn't find any hints searching the
web) how would I start a scenario where:
- the main thread includes a thumbnail-listbox (i.e. a user-control that
shows the thumbnails)
- a separate thread creates thumbnails from files within a set of
directories
- after a thumbnail-file has been created, it is to be added to the
thumbnail-listbox

I've been trying this for over a week now so any help will be greatly
appreciated ...

TIA & Cheers,
Olaf
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

http://msdn.microsoft.com/msdnmag/is...s/default.aspx

Ken
---------------------
"Olaf Rabbachin" <Ol*********@IntuiDev.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi folks,

I have a form in which I'm starting a separate thread (which is searching
directories for image-files and generating thumbnails of them in different
dir). Within the form, I also have a FileSystemWatcher, which will trigger
as soon as a thumbnail is generated from that thread. When triggered, the
thumbnail-image that has just been found is to be displayed in a
"Panel-UserControl" (consisting of a panel and a couple of other controls).
The Panel-UserControl itself will add one Item-UserControl (consisting of a
picturebox and a couple of other controls) for each thumbnail to be
displayed - and that's where everything goes boom:
The FSW's creation-trigger (have tried the trigger-function residing both
in the form and the Panel-UserControl) will call the Panel-UserControl's
AddThumbnail-function which in turn will create a new Item-UserControl in
which that image is to be displayed. But as soon as I'm issuing a
"Panel.Controls.Add ItemControl" or a "ItemControl.Parent=PanelControl",
I'll get the exception ~"controls created on one thread cannot be parented
to another thread".

If it's just not possible (at least I didn't find any hints searching the
web) how would I start a scenario where:
- the main thread includes a thumbnail-listbox (i.e. a user-control that
shows the thumbnails)
- a separate thread creates thumbnails from files within a set of
directories
- after a thumbnail-file has been created, it is to be added to the
thumbnail-listbox

I've been trying this for over a week now so any help will be greatly
appreciated ...

TIA & Cheers,
Olaf
Nov 21 '05 #2

P: n/a
Hi,

Ken Tucker [MVP] wrote:
http://msdn.microsoft.com/msdnmag/is...s/default.aspx


thanks, Ken.

Cheers,
Olaf
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.