如何在C#中弹出错误消息 [英] How to pop up a error message in c#

查看:748
本文介绍了如何在C#中弹出错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在单选按钮列表示例中弹出一个错误消息.如果用户未能选择按钮,我想弹出一个错误消息,提示您必须选择每个按钮.我怎么做.我可以提供代码吗?

I want to pop up an error messsage in a radio button list example.if user fails to select a button i want to a pop up showing an error message saying you have to select each buton. how do I do that. Can I have the code please.

推荐答案

MessageBox.Show()
http://msdn.microsoft.com/en-us/library/tewzaxwc.aspx [ ^ ]
MessageBox.Show()
http://msdn.microsoft.com/en-us/library/tewzaxwc.aspx[^]


如果您真的不知道操作方法",请查看向导的解决方案.我很确定您不是真正在乎如何"显示消息,而是在何时".

在不知道Windows窗体应用程序中预期的工作流程的情况下,很难说出来.我将假设您正在执行WinForm应用程序,而不是在执行ASP.NET,因为您没有使用ASP.NET标记问题.

如果按下某个按钮来处理表单,则该按钮的单击方法将是检查单选按钮是否已选中并显示消息的理想位置.

最好的问候,

—MRB
If you really don''t know the "How" then look at wizzards solution. I''m quite sure that you''re not really concerned with "how" to show the message, but rather the "When".

Without knowing the intended workflow within your windows form application it''s kind of hard to tell. I''ll assume that you''re doing a WinForm application and not doing ASP.NET as you didn''t tag your question with ASP.NET.

If there is a button that gets pressed to process the form, that buttons click method would be the ideal place to check if a radio button is selected and show the message.

Best Regards,

—MRB


不是那样做,而是使用事件机制来设置标志,并根据需要启用/禁用按钮.用户讨厌被消息框弹出窗口打断.
Instead of doing it that way, use the event mechanism to set flags, and enable/disable the buttons as appropriate. Users HATE being interrupted by message box popups.


这篇关于如何在C#中弹出错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆