Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Questions/Problems with subclassing controls and forms
Message
From
07/08/2010 11:52:09
 
 
To
06/08/2010 09:21:10
General information
Forum:
ASP.NET
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01475116
Message ID:
01475609
Views:
47
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.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform