It seems this is related to the fact that your DataGridView is not visible (on the background tab) when you set its DataSource (when Form1_Load code is called) even though the exception is not triggered until later. For instance it will work if you handle the VisibleChanged
event of the DataGridView and move your Form1_Load code to there instead only taking care to ensure that the initialization code only fires on the first time TabPage n is clicked (effectively a pseudo-Initialized event).
private bool dgvInitialized = false;
private void dgvTest_VisibleChanged(object sender, EventArgs e)
{
if (dgvTest.Visible && !dgvInitialized)
{
dgvInitialized = true;
// Move Form1_Load code to here instead...
}
}