Hi Denis,
>In the button code you should not use PARENT.. its mistake.. Yes, I agree ... and I probably should have mentioned that also in my earlier reply to Thomas (which, like your post, was about using interfaces).
>3) Why you showDialog could not closed - reason. Form.DialogResult is NOTHING!. Set the DialogResult to correct value before Me.Close.No, that's not the problem. Try it, it doesn't matter. Any Form can be shown modally ... and so it doesn't necessarily have to set a DialogResult.
~~Bonnie
>Hi Thomas,
>.Net offer too many ways to do simple thing more complicated and complex thing easy :)
>
>At the first.. just some comments, I'd like to expose forms using interface when you try to call DoExit method.. this is more good style
>So it must looks like
>Public Interface IMyFormInterface
> Sub DoExit()
>End Interface
>
>Public Class MyForm
> Inherits System.Windows.Forms.Form
> Implements IMyFormInterface
>
>
>When you develop framework - its more good way .
>
>Second.
>
>In the button code you should not use PARENT.. its mistake..
>You should use a code like
>
>Dim loParentForm as System.Windows.Forms.Form = Me.FindForm()
>IF Not IsNothing(loParentForm)
> Dim loMyFrameworkForm as IMyFormInterface = TryCast(loParentForm, IMyFormInterface)
> IF Not IsNothing(loMyFrameworkForm)
> loMyFrameworkForm.DoExit()
> END IF
>END IF
>
>In this case you have interllisense and don't use reflection. I repeat - parent should not be used, because it could have reference not to the form. Offer to use to use FindForm() FindControl() and so on.. and then convert type.
>
>
>3) Why you showDialog could not closed - reason. Form.DialogResult is NOTHING!. Set the DialogResult to correct value before Me.Close.
>
>
>Denis.