关闭esc键上的Windows窗体时出现问题? [英] problem in close the windows form on esc key?

查看:82
本文介绍了关闭esc键上的Windows窗体时出现问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目EXIT按钮中,包含的代码为me.close()
并将退出"按钮的名称"属性设置为cmdExit.

并将退出按钮"的对话框结果属性"设置为取消".

并将表单的CancelButton属性设置为cmdExit.

上面的代码有时仅适用于
. Forms仅具有vb.net控件.

为什么它不起作用.还有其他解决方法.
请解决该问题.

In my project EXIT button is there which contained the code as me.close()
and set Name property of the Exit button as cmdExit.

and have set Dialog Result Property as of Exit Button as Cancel.

And have set CancelButton Property of the form as cmdExit.

Above code has worked for sometimes only.
Forms has vb.net controles only.

Why it is not working.Is there any other way to resolve it.
Kindly solve it

推荐答案

我不明白您要尝试执行的操作,但是如果您要关闭任何表单,可以将此代码粘贴到Keypress事件中表格

如果Asc(e.KeyChar)= Keys.Escape然后

me.close()

如果结束



如果您需要更多帮助,请与我联系! :cool:
I don''t get u''re trying to do but if u want close any form u can paste this code in the Keypress event of the form

If Asc(e.KeyChar) = Keys.Escape Then

me.close()

End If



If u need more help contact me! :cool:


这篇关于关闭esc键上的Windows窗体时出现问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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