Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Windows.MessageBox: Yes Button is missing

Tags:

c#

wpf

In my WPF Application (.NET 3.5) I create a MessageBox like this:

if (System.Windows.MessageBox.Show("Eine neue Version von Qualisoft steht zum Download bereit. Möchten Sie diese installieren?", "Neue Qualisoft Version", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
...
}

One of my customers get this result:

I tested this on about 10 systems and I cant reproduce this result.

Does anyone know why the Yes Button is missing?

like image 869
schini Avatar asked Jul 26 '26 17:07

schini


2 Answers

This issue is NOT (directly) related to .NET. WPF actually redirects the call to the operating system, to be specific by this call:

UnsafeNativeMethods.MessageBox(...)

There can be other things that go wrong. This might be caused by a language pack or something, but I doubt that. Also video card drivers sometimes mess up UI controls. There is not much to go on now since it can't be reproduced easily.

You have to go check by taking out parts that might be the issue. Start in safe mode and check if the issue persists. Try to make a new default application with just this call. Is the behavior still the same? Then continue. Else something in your code might be causing this.

like image 190
Patrick Hofman Avatar answered Jul 29 '26 07:07

Patrick Hofman


Your customer is playing a prank on you and sent you a photo-shopped screenshot. Probably a not-so-subtle hint that he's a bit tired of having to constantly deal with new versions. Something like that.

The native MessageBox() winapi function does not have an option to only display the No button.

Just prank him right back and recommend he drags the machine to a 4th story window and let it slip. With the advice that opening the window first is entirely optional.

like image 29
Hans Passant Avatar answered Jul 29 '26 06:07

Hans Passant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!