I have the c# code below for a VSTO excel app im working on however for somereason clicking ok on the dialog form (which should close the form) causes the dialog to re-appear. This happens twice.
I am concerned I am not accessing the value on the form correctly although I cant find how to set its parent to being the Excel workbook.
Code:private void ThisWorkbook_Startup(object sender, System.EventArgs e) { frmPromptForConnection objfrmPromptForConnection; objfrmPromptForConnection = new frmPromptForConnection(); objfrmPromptForConnection.Parent = this; DAL.Connection = "Production"; objfrmPromptForConnection.ShowDialog(); if (objfrmPromptForConnection.ShowDialog() == DialogResult.OK) { DAL.Connection = objfrmPromptForConnection.Connection; } } else { DAL.Connection = "Production"; } }





Reply With Quote