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 了!
尝试使用 System.Windows.Forms.MessageBox 类,而不是 System.Windows.MessageBox。