我在注释中指出的行上出现空引用异常。有谁知道为什么会这样?
var form = Form.ActiveForm as Form1;
var doSave = MessageBox.Show("Would you like to save this measurement?",
"Save Measurement",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (doSave == DialogResult.Yes) // User wants to save the current measurement.
{
curName = ShowDialog("Measurement Name", "Save Measurement");
// ERROR HERE ****
int ret = form.databaseClass.GetFirstSoundReadyTestOccurrence(form.testNumber.Text);