使用取消按钮验证文本框 [英] Validating textbox w/ Cancel button

查看:78
本文介绍了使用取消按钮验证文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有文本框和取消按钮的表单。我有一个常规的

处理textbox.validating,我有表单设置所以取消

按钮是取消按钮。


当用户点击取消按钮时,textbox.validating正在调用
。我不想要它,因为他们正在退出屏幕

验证没有必要完成。


我该怎么办?那个。


谢谢。


Darin


***通过Developersdex发送 http://www.developersdex.com ***

解决方案

如果你想在用户按下取消时退出表格,那么就说,在

btnCancel点击事件


Me.Close()


并且表格将关闭

-

-iwdu15

我知道,但问题是当用户点击EXIT时,

textbox.validating事件在cancel.click完成之前被调用,所以

正在验证文本框。它不需要验证,因为

用户退出。


Darin


** *通过开发人员指南 http://www.developersdex.com 发送***


是的,关闭表单会导致''验证''发生。一,删除

" controlBox"从表单中,用户无法以这种方式关闭它。然后在

btnCancel_click事件中,将模块级变量设置为mCanceling为

True然后在验证事件中...如果不是mCanceling ...

另一种方法。在btnCancel_Click事件中:

Removehandeler TextBox1.validating,TextBox1_Validating的地址

-

Terry

" Darin" ;写道:


我知道,但问题是当用户点击EXIT时,

textbox.validating事件在取消之前被调用.click已完成,因此

正在验证文本框。它不需要验证,因为

用户退出。


Darin


** *通过开发人员指南 http://www.developersdex.com 发送***

I have a form w/ a textbox and Cancel button on it. I have a routine to
handle textbox.validating, and I have the form setup so the Cancel
button is the Cancel button.

WHen the user clicks on the cancel button, the textbox.validating is
being called. I don''t want it to be since they are exiting the screen
the validation doesn''t have to be done.

How can I do that.

Thanks.

Darin

*** Sent via Developersdex http://www.developersdex.com ***

解决方案

if you want to exit the form when the user presses cancel then just say, in
the btnCancel click event

Me.Close()

and the form will close
--
-iwdu15


I know that, but the problem is when the user clicks EXIT, the
textbox.validating event is called BEFORE the cancel.click is done, so
the textbox is being validated. It doesn''t need to be validated because
the user is exiting.

Darin

*** Sent via Developersdex http://www.developersdex.com ***


Yes, closing the form causes ''validating'' to take place. One, remove the
"controlBox" from the form, so the user cant close it that way. Then in the
btnCancel_click event, either set a module level variable like mCanceling to
True and then in the validating event ... If not mCanceling ...
Another approach. in the btnCancel_Click event:
Removehandeler TextBox1.validating, Addressof TextBox1_Validating
--
Terry
"Darin" wrote:

I know that, but the problem is when the user clicks EXIT, the
textbox.validating event is called BEFORE the cancel.click is done, so
the textbox is being validated. It doesn''t need to be validated because
the user is exiting.

Darin

*** Sent via Developersdex http://www.developersdex.com ***


这篇关于使用取消按钮验证文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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