I have a datable that I have populated with data from SQL server and a datagridview that is bound to that data.
Due to several queries that take some time to populate various columns in the datatable, cellformatting then picks those up and displays an icon for the resulting column (about 8 columns at the moment) and other columns in text-format.
I have added a thread to give the appearance of increased speed by populating 3 important text-based columns and the thread runs in the background, populating the rest of the datatable, which in turn, gets picked up by the cellformatting event of the datagridview.
Now, it works if I scroll the grid and return back to where I scrolled from and if I disable my thread and go through the lengthy process of display, the icons appear so I know my sub works either on the same thread or as a separate one - its just the painting on the separate thread isn't doing its job.
Other columns within my thread are text-based, and they appear via the separate thread, as the datatable gets populated - but not the icons (unless I scroll the dgv off view and then back again).
Having the process make the user wait while it does the whole thing is not acceptable to them unfortunately so I need to solve this - I cant do anything about improving the queries as they can have 30,40 or even 50 columns (even though they're just text, it still takes time to do the queries themselves).
Anyone have any ideas on how to force cellformatting to re-paint on a specific cell basis?
What I have tried:
I have looked at putting a loop to go through the DGV (from the main thread) and perform a formattedvalue query in the loop as I read on several other forums posted over the years that it forces the datagrid cell formatting but it did nothing.
I have also checked out the dgv.refreshedit during the cellformatting process and that did nothing as well oncellformatting handled sub and
e.FormattingApplied = True
in the oncellformatting sub - still nothing.