Updating listbox using a thread in

Thi thread checks if a Invoke is necessary and then uses Invoke if it is necessary.

which are required to marshall the call from a background thread to a main UI thread.

I have developed a windows forms c# application, i just want update items in a Listbox in the main form by spin offing another thread without blocking the GUI form.

Since threads cannot access form entities like listbox, i thought of using delegates.

Anyone writing smart client applications will eventually run into a situation where some work must be performed asynchronously on a background thread.

Long running computations, database access, web service calls and large file I/O are all good candidates.

Any long-running operation must be performed on a background thread to avoid freezing the user interface.

More often than not the UI state needs to change after the background operation completes.

updating listbox using a thread in-40updating listbox using a thread in-73updating listbox using a thread in-47updating listbox using a thread in-59

Copy the database dataset, by creating new dataset and declaring by main Dataset.On the first tab, I have another form (frm Chassis), on which there is a listbox which is related to the current record by the [Serial Number] field. This list box updates perfectly when navigating between records when I just have the frm Chassis form open - but when I open the main form (with the tabbed control), and navigate the frm Chassis records, the listbox does not update.The listbox has a rowsource of a query, which refers to the form as [Forms]! Any help would be great, thanks, *** Sent via Developersdex Don't just participate in USENET..rewarded for it! [Serial Number] Meaning: net Oakland, CA (USA) -----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv i QA/Aw UBQAgf Roech Kq Ou FEg EQJH6QCg3b JRSFx Umbi B8wwtc Hjcnl 3d UYo An Am H kz Vk Np LNP6iffa NT g hm H5 =y XDp -----END PGP SIGNATURE----- Mark wrote: Hi - I have a form (frm Main), which has a tabbed control on it.Perhaps the UI must show feedback as the operation executes – think progress bar. I’ve created a sample program where a List Box is bound to an Observable Collection.It would be great to update the UI right from the background thread, but WPF has strict rules concerning threading. With this binding in place any changes to the collection indirectly manipulate the List Box.

Leave a Reply