NullReferenceException on ShowDialog

  • Thread starter Thread starter LunchBox
  • Start date Start date
L

LunchBox

This is a bit strange and I can't figure it out. The exception below is
only thrown once, after the computer is booted and the program is launched.
But after the exception is thrown, it is not thrown again until I reboot and
start the program again, but again, only that one time.

private void grid1_DoubleClick(object sender, System.EventArgs e)
{
DataGridCell myCell = grid1.CurrentCell;
System.Int64 SelectedID = Convert.ToInt64(grid1[myCell.RowNumber,0]);
NewClass NewForm = new NewClass(SelectedID);
NewForm.ShowDialog(this); <<<<<<<< Exception thrown here
}

I've tried doing a try catch, but I cannot seem to handle this exception.
Any ideas?
 
Back
Top