Note that there are some explanatory texts on larger screens.

plurals
  1. POControl.Refresh() Across Threads
    text
    copied!<p>OK, please disregard what has gone before. I'm not getting the errors anymore, so it seems my problem is with getting a Chart to update when I change the values to which the Chart is data bound.</p> <p>//Disregard below here</p> <p>Hi all. I have a WinForms application that has a panel, <code>panel1</code>. A background thread creates some other controls that then get added to <code>panel1</code> like so</p> <pre><code>panel1.Controls.AddRange(myArrayOfControls); </code></pre> <p>This works great and I can see my controls get added. But, when new data comes in on another thread, I update values in the controls' parent objects and then need to <code>Refresh()</code> to get the display to update with the new values. Calling <code>Refresh()</code> in either context, the thread where the data comes in or the objects that receive the updated data causes an InvalidOperation exception because Invoke is required. I've tried using Invoke in my model objects and also the thread where the data is incoming and can't seem to shake the error.</p> <p>If anyone has some guidance I'd greatly appreciate it.</p> <p>UPDATE: Here's a little more info. I didn't think it would require it, but I was wrong. :)</p> <p>I have an object class MyObject. This MyObject class gets created in a thread called topologyThread. Data comes in on dataThread. Instances of MyObject have a Panel instance variable and the Panel has child Controls including two Charts from the System.Windows.Forms.DataVisualization.Charting namespace. So, as data comes in on dataThread, I update the respective data values in the MyObject objects and then need to refresh the Charts to show the updated data.</p> <p>I do know the data is processing fine. In my MyObject class, I'm logging the new values to Console in the setter for the property and see the new values show up.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload