0

Is there any advantage of using

System.Windows.MessageBox.Show();

over

System.Windows.Forms.MessageBox.Show();

except that you don't have to reference WinForms assembly (which I have to do either way) and that you can set parent window more easily (which is no big deal)?

Tomasz Grobelny
  • 2,666
  • 3
  • 33
  • 43
  • 3
    No difference, they both pinvoke the native Windows MessageBox() function. – Hans Passant Dec 07 '12 at 20:30
  • Depending how stylized your app is you may want to roll your own. It's not that much work and there are plenty of examples to search for. – kenny Dec 07 '12 at 22:25
  • 3
    possible duplicate of [system.windows.messagebox vs system.windows.forms.messagebox](http://stackoverflow.com/questions/4660587/system-windows-messagebox-vs-system-windows-forms-messagebox) – Wai Ha Lee Jun 08 '15 at 07:46

1 Answers1

0

System.Windows.MessageBox is from WPF, and is part of the assemblies (PresentationFramework.dll).

System.Windows.Forms.MessageBox is from , and is part of the the assemblies.

If your program is , use the System.Windows.Forms.MessageBox, otherwise go for the System.Windows.Messagebox (WPF).

I'm pretty sure they eventually use the same API call.

Abhishek
  • 2,925
  • 4
  • 34
  • 59
The Cookies Dog
  • 1,915
  • 2
  • 22
  • 38
  • 1
    The question is whether the WPF version is better at anything? Anything. It certainly is worse in a few areas (eg. number of available button combinations). – Tomasz Grobelny Dec 07 '12 at 20:59
  • Easier to style, the rest is pretty much identical to the WinForms. As said, use WPF on WPF and WinForms on WinForms if you don't need the added button combinations. – The Cookies Dog Dec 08 '12 at 12:48
  • Could you elaborate on the styling? It contradicts what Hans Passant said... (at least this is my impression) – Tomasz Grobelny Dec 08 '12 at 13:36
  • @TomaszGrobelny You might be interested in comparing their implementation, using a decompiler such as ILSpy. The Windows Forms version does more, but I don't know what it's good for. Maybe that helps you. – ygoe Mar 20 '16 at 11:14