471,325 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

how to inherite a class from System.windows.form.MessageBox?


Hi,
I want to add more buttons to messagebox, such as "Apply All".
Can i implement a custom messagebox, inherite from System.Windows.Form.MessageBox?

Best wish,

harvie

2006-1-18
Jan 18 '06 #1
4 7230
> Can i implement a custom messagebox, inherite from System.Windows.Form.MessageBox?

No you'll have to inherit from Form and build it from scratch. The
standard MessageBox is provided by the operating system and not
extensible.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jan 18 '06 #2
Hello Mattias,

thanks!
Can i implement a custom messagebox, inherite from
System.Windows.Form.MessageBox?

No you'll have to inherit from Form and build it from scratch. The
standard MessageBox is provided by the operating system and not
extensible.

Mattias

Jan 18 '06 #3
> No you'll have to inherit from Form and build it from scratch. The
standard MessageBox is provided by the operating system and not
extensible. Mattias


Actually, that is kinda incorrect. You can extend the MessageBox class,
but it requires a lot PInvoke class and a lot of pain for it to be
worthwhile. Below is an article on MSDN that talks about it:

http://msdn.microsoft.com/msdnmag/is...e/default.aspx

Jan 18 '06 #4
>Actually, that is kinda incorrect. You can extend the MessageBox class,

OK if you want to play the nitpicking game you're incorrect too. You
can't extend the MessageBox _class_ since it only has a private
constructor (and should really have been a static class if they had
existed in v1).

Sure you can do all sorts of weird things with the message box dialog
window with Win32 APIs, but just because you can doesn't mean you
should.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jan 18 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by glenn | last post: by
2 posts views Thread by Ryan Liu | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.