如何检测默认按钮并取消 [英] How do I detect a button that is default and cancel

查看:64
本文介绍了如何检测默认按钮并取消的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

如何检测默认按钮并取消.我使用了以下代码

How do I detect a button that is default and cancel. I have used the following code

MessageBox.Show(" The default and cancel buttons are => " + this.AcceptButton.ToString() + " and => " + this.CancelButton.ToString());

regds

regds

Manoj Gokhale

Manoj Gokhale

推荐答案

您在哪里使用messgebox?就像您要检测单击了哪个按钮一样?

where are you using messgebox? Is it like you want to detect which button is clicked ?

如果是,则需要为其提供事件处理程序.

if yes you need to have event handlers for them.

就像

 Button button1 = new Button();
            button1.Click += Button1_Click;

 private void Button1_Click(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }



这篇关于如何检测默认按钮并取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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