[ACCEPTED]-C# ShowDialog Parent Form is null-forms
You should check the Owner
instead of the Parent
What 6 you're setting in the constructor of ShowDialog 5 is the Owner property. Which tells the form 4 which other form "owns" it. The parent is 3 (as indicated by Mario) described the ownership 2 relationship for a Control.
so you should 1 change your code to:
if (this.Owner == null)
{
var sc = new ScanCheck();
sc.Show();
this.Hide();
}
and it should work.
Parent is a property inherited from control 5 which is used to describe embedding relationships 4 ( a label has as parent the form).
I do not 3 think it is set when using ShowDialog().
I 2 assume that Owner is the correct property 1 to check.
hth
Mario
Since you are passing DisplayDataForm
as parent in lw.ShowDialog(this)
; DisplayDataForm 2 is the parent of LoadWorkstationFile form 1 when calling it second time.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.