Been a long time user of ObjectListView and love it.
Having a problem now though. I have a form with an OLV on it and it receives an event to tell it when a Dictionary<Type,List<IModuleReport>() collection is updated so I can make it refresh the OLV.
When this happens, the data shows up just fine but when I call AutoSizeColumns() seemingly nothing happens. After debugging into the AutoSizeColumns() method I discovered that an invalidoperation exception is occurring because the code is attempting to get the width of a columnHeader which was created in the original UI thread.
Greetings,
Been a long time user of ObjectListView and love it.
Having a problem now though. I have a form with an OLV on it and it receives an event to tell it when a Dictionary<Type,List<IModuleReport>() collection is updated so I can make it refresh the OLV.
When this happens, the data shows up just fine but when I call AutoSizeColumns() seemingly nothing happens. After debugging into the AutoSizeColumns() method I discovered that an invalidoperation exception is occurring because the code is attempting to get the width of a columnHeader which was created in the original UI thread.
Message: Cross-thread operation not valid: Control 'processResultList' accessed from a thread other than the thread it was created on.
The error is occurring in ObjectListView.cs line 3943 -
switch(column.Width) // BOOM - InvalidOperationException
Is there any way for me to get around this without modifying the OLV code myself?
Thanks
Ed Kramer
As noted in the FAQ, only a limited set of operations are thread safe.
You will need to use
BeginInvoke()
. Have a look insideSetObjects()
to see how it works.I am getting The thread 0x11f90 has exited with code 259 (0x103) on form load. What would cause that?