I am having trouble finding out what the key differences are between the two message boxes. What is the difference between System.Windows.MessageBox
and System.Windows.Forms.MessageBox
?
A message box is a prefabricated modal dialog box that displays a text message to a user. You show a message box by calling the static Show method of the MessageBox class. The text message that is displayed is the string argument that you pass to Show.
System.Windows.MessageBox
was added with WPF, and exists within the WPF assemblies (PresentationFramework.dll).
System.Windows.Forms.MessageBox
was added with Windows Forms, and exists within the Windows Forms assemblies.
If your program is a Windows Forms program, I would use the latter (System.Windows.Forms.MessageBox
), as it won't pull in a dependency on WPF. On the other hand, if you are developing for WPF, I'd use System.Windows.MessageBox
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With