I have a WinForms project with a form that incorporates a datagrid.
I have two methods which I call in the Load event for the form.
I have a PopulateForm() method which grabs the data from SQL server.
Followed by a FormatDatagrid() method that circles through the datarows in the grid and colours them according to a condition I have specified in the code.
I have also added a Refresh button on the form which calls both of these methods again.
When my form loads the datagrid is populated with all the correct data, but it is unformatted.
Yet when I click the refresh button (which runs the Exact same code) the datagrid is correctly formatted as I want.
It seems to me I am misunderstanding what the Load event does. As I step through the code I notice the program is running through the formatting code BEFORE the form is actually open, which I assume why the formatting does not work on the Load event.
Which event should I be using to ensure the datagrid is formatted immediately when the user opens the form.
This should do the work