J
Jazza
Hi,
I am writing an application which displays a list of computers on a network
and then pings each one and displays the result.
To keep the UI responsive, I am doing the ping operation using a
BackgroundWorker component. The Ping method loops through a list of Computer
business objects, pings the name of the computer and stores the result in a
property of the Computer object called Result.
The Computer object also implements INotifyPropertyChanged interface, which
raises a PropertyChanged event when the Result property is modified.
I have an event handler in my form class which listens for the
Computer.PropertyChanged event, and attempts to update the corresponding
ListViewItem with the result of the ping.
However, as soon as I reference the ListView control, or any of the items, I
get:
Cross-thread operation not valid: Control 'ComputerListView' accessed from a
thread other than the thread it was created on.
How can I ensure the ListView gets updated?
Regards,
James
I am writing an application which displays a list of computers on a network
and then pings each one and displays the result.
To keep the UI responsive, I am doing the ping operation using a
BackgroundWorker component. The Ping method loops through a list of Computer
business objects, pings the name of the computer and stores the result in a
property of the Computer object called Result.
The Computer object also implements INotifyPropertyChanged interface, which
raises a PropertyChanged event when the Result property is modified.
I have an event handler in my form class which listens for the
Computer.PropertyChanged event, and attempts to update the corresponding
ListViewItem with the result of the ping.
However, as soon as I reference the ListView control, or any of the items, I
get:
Cross-thread operation not valid: Control 'ComputerListView' accessed from a
thread other than the thread it was created on.
How can I ensure the ListView gets updated?
Regards,
James