MessageBoxButton 异常 WPF、VB.net 项目

问题描述 投票:0回答:1
I am using the following code in a Button_Click event:
        If OwordDoc IsNot Nothing Then
            System.Windows.MessageBox.Show("A document is already open.", MessageBoxButton.OK, MessageBoxImage.Information)
            Return
        End IF

无论我使用哪个 MessageBoxButton 枚举,我都会收到以下运行时错误。

(InvalidEnumArgumentException: 'The value of argument 'button' (64) is invalid for Enum type 'MessageBoxButton'.)

我没有在其他地方使用任何其他 MessageBox。虽然这是第一次 wpf 项目,但这看起来很基础,我做错了什么?

我查过之前的 StackOverflow Q/A,感觉我快要嫁给 Microsoft Copilot 了!

wpf vb.net exception messagebox
1个回答
0
投票

尝试使用 System.Windows.Forms.MessageBox 类,而不是 System.Windows.MessageBox。

© www.soinside.com 2019 - 2024. All rights reserved.