Updating listbox using a thread in dating services online adult photo personals sites
I realize what I'm doing is probably pretty silly, but I'm in the middle of learning WPF and would like to know how to do this. The listbox is being used to deliver status messages about the program while it's running.
For example "Server started" "New connection at IP #" etc.
Below is a simple method I’ve used that seems to work well, and allows you to pass parameters if needed.
More often than not the UI state needs to change after the background operation completes.
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.
You can, but you must advise your Backgroundworker to report state, and send the input for the box with the current state to that event.
In the method for that event, you can access the box and put the new value in. I add functions like the following so that I can add items to the list box from either the main thread or background threads.
Following code in the below shows how i used a delegate to do that task, but it blocks the GUI form.