i want to get output from windows form to the calling application that is class library.
Form1 f=new Form1();
f.Show();
if(f.PropertyName!=null)
{
}
f.PropertyName is always null. After f.show() it straightaway runs if ()condition. is there any way to get the output from the form1?
Show()is non-blocking. UseShowDialog(), or add a delegate to theFormClosing()event of your form and move yourif()logic into it.EDIT:
Here’s an example of a lambda “delegate” for the closing event:
EDIT 2: Whether you handle
FormClosed()orFormClosing()depends on your specific needs. If you want to cancel the form close on a “bad” value,FormClosing()lets you cancel the form close.