Hi, Jay.
I wonder if you should put your code in the CellFormatting event handler for the DataGridView control.
I'm unsure of your skill level, so I apologize if the steps below are too simple.
- Select the DataGridView control in the designer.
- Click the lightning bolt at the top of the Properties window to show the events.
- Double-click the CellFormatting event to create the event handler function.
They do it here. Maybe you can get an idea from their source code.
https://learn.microsoft.com/en-us/dotnet/desktop/winforms/controls/how-to-customize-data-formatting-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8
Good luck.