如何启用对文本框的关注,直到满足条件? [英] How to enable focus on textboxes until condition met?

查看:73
本文介绍了如何启用对文本框的关注,直到满足条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

vb中的代码是什么,它可以使您专注于某些对象,如文本框,日期时间选择器或组合框,直到满足某些条件为止.比方说,

文本框A的数字为"11",但条件是如果> = 10,则消息框将提示用户,随后用户将无法选择其他文本框或按钮,直到满足条件为止.

在Visual BASIC中这可能吗?如果是这样,我们如何启用此功能.

解决方案

这是VB.NET还是VB6?在VB.NET中,控件具有Focus()方法.调用该命令可将焦点放回原处并检查丢失焦点的事件,这样焦点将回到那里,直到他们输入OK值为止.哪个UI不好,实际上,理想情况下,您的文本框应该只接受正确范围内的值,例如,如果用户只能输入1到10,则下拉框是更好的UI.


What is the code in vb for enabling focus on certain objects like textboes, datetimepickers, or combo boxes until certain condition are met. Let''s say,

Textbox A has the number "11", but the condition was if >= 10, then a messagebox will prompt user, followed by the user are unable to select other textboxes or buttons until the condition is met.

Is this possible in Visual BASIC? If so, how do we enable this function.

解决方案

Is this VB.NET, or VB6 ? In VB.NET the control has a Focus() method. Call that to put the focus back and check in the focus lost event, that way, the focus will go back there until they enter an OK value. Which is bad UI, really, your textbox should ideally only accept values in the correct range, and if the user can only enter 1-10, for example, a drop box is better UI.


这篇关于如何启用对文本框的关注,直到满足条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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