Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2005

Tip: Looking for answers? Try searching our database.

Can't override ShowDialog

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin Hart - Memory Soft, S.L. - 20 Jan 2005 08:51 GMT
Hi:

I have a set of derived forms that I wish to implement an 'Execute' method
to launch these forms, but I also wish to hide the 2 inbuilt ShowDialog
methods so these can't be called unwittingly.

I have tried:

private new DialogResult ShowDialog() { }
private new DialogResult ShowDialog(IWin32Window aParent) { }

but these are completely ignored and the 2 methods are still visible and
usable.

How can I hide these?

TIA,
Martin.
saurabh - 20 Jan 2005 10:07 GMT
why are your methods private ?

--Saurabh

> Hi:
>
[quoted text clipped - 14 lines]
> TIA,
> Martin.
Martin Hart - Memory Soft, S.L. - 20 Jan 2005 10:10 GMT
Because I'm trying to hide them so they can't be called externally
accidentally.

Regards,
Martin.

> why are your methods private ?
>
[quoted text clipped - 18 lines]
>> TIA,
>> Martin.
saurabh - 20 Jan 2005 10:18 GMT
In your case, I think you should have the Execute method as a static method.
In your class, hold the object of your form privately, so that the outside
world won't be able to create the form object 'accidentally'
If the world can create a System.Windows.Form, then it will be able to call
ShowDialog.

or you can define your methods publically and call do the checks and call
your execute method

public new DialogResult ShowDialog()
{
   return this.Execute();
}

I assume Execute() method returns a DialogResult

HTH,

--Saurabh

> Because I'm trying to hide them so they can't be called externally
> accidentally.
[quoted text clipped - 24 lines]
>>> TIA,
>>> Martin.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.