I have a form, called frmMain, which is a MDI container.
frmMain shows an instance of frmInventory. That instance then appears within frmMain. From a menu on frmInventory (that is added to frmMain's menu) I create an instance of frmAddComm.
However, frmAddComm is basically an add new item window, prompting for input data, which it then uses to create a new item to send back to frmInventory.
Try as I might, I cannot get frmAddComm to appear within the bounds of frmMain.
I have tried:
frmAddComm addComm = new frmAddComm();
addComm.MDIParent = this.Owner;
addComm.Show();
and
frmAddComm addComm = new frmAddComm();
addComm.MDIParent = this.Owner;
addComm.ShowDialog();
and
frmAddComm addComm = new frmAddComm();
addComm.MDIParent = (MDIClent)this.Parent;
addComm.Show();
The last option however does not pause and wait for addComm.Close() to happen, and thus continues on right through my if statement to determine if OK or Cancel was pressed, thus defaulting to cancel.
For program functionality I have this:
frmAddComm addComm = new frmAddComm();
addComm.MdiParent = this.Owner;
addComm.ShowDialog();
if (addComm.DialogResult == DialogResult.OK)
{
qc_Inventory.Add(addComm.NewCommunicator);
ManageInventory(tabInventory.SelectedIndex);
}
However, it does not put addComm within the bounds of frmMain, which is what I want.