WPF 消息框显示错误消息
WPF Messagebox shows Error message
我正在开发一个 WPF 应用程序,我想显示带有信息或问题等符号的消息框。我写了这段代码:
MessageBox.Show("Added Sucessfully","Alert",MessageBoxImage.Information);
但显示 error/red line:
Error:system.windows.messagebox.show(string,string,messageboximage) has some invalid arguments
您错过了 MessageBoxButton
论点。尝试以下操作:
MessageBox.Show("Added successfully", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
确保您使用的是来自 System.Windows
命名空间的 MessageBox
,而不是 System.Windows.Forms
。
我正在开发一个 WPF 应用程序,我想显示带有信息或问题等符号的消息框。我写了这段代码:
MessageBox.Show("Added Sucessfully","Alert",MessageBoxImage.Information);
但显示 error/red line:
Error:system.windows.messagebox.show(string,string,messageboximage) has some invalid arguments
您错过了 MessageBoxButton
论点。尝试以下操作:
MessageBox.Show("Added successfully", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
确保您使用的是来自 System.Windows
命名空间的 MessageBox
,而不是 System.Windows.Forms
。