用户标签或单击其他文本框时检查输入 [英] Check input when user tab or click other textbox
本文介绍了用户标签或单击其他文本框时检查输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
当用户按下Tab键或单击其他文本框时,我想用来检查文本框的事件是什么?我已经有了代码,但是我不知道事件.它只是在用户想要创建新帐户时检查确认密码.有人可以告诉我吗?
Hi all,
What is the events for textbox which I want to use to check when user press Tab key or click other textbox? I already have the code, but I don''t know the events. It just check the confirmation password when user want to create new account..Could someone tell me?
推荐答案
您可以在文本框中使用onblur事件,这基本上意味着焦点从控件中移出
you can use the onblur event in a textbox which basically means that the focus is moved from the control
尝试针对失焦事件使用以下代码
try following code for lost focus event
Private Sub TextBox1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
Dim est As Decimal
If TextBox1.Text.Length = 0 then Exit Sub '' optional
If Not Decimal.TryParse(TextBox1.Text.Trim, est) Then
e.Cancel = True
TextBox1.SelectAll()
Else
TextBox1.Text = est.ToString("N0")
End If
End Sub
希望对您有帮助
祝你好运
快乐编码
hope it will Help u
Best Luck
Happy Coding
这篇关于用户标签或单击其他文本框时检查输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文