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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top