Murray Brown
asked on
Visual Studio 2005 VB After_Update equivalent
Hi
What is the best equivalent of the VBA After_Update event in Visual Studio 2005 for a text box on a indows form?
Thanks
What is the best equivalent of the VBA After_Update event in Visual Studio 2005 for a text box on a indows form?
Thanks
I thin it is TextChanged
ASKER
Hi
That was the first thing I tried but the problem with that is that it calls the event after each character.
I need something that fires after I have type the whole word.
I am using the LostFocus event, but it is not quite the same.
Anyone know of anything else?
That was the first thing I tried but the problem with that is that it calls the event after each character.
I need something that fires after I have type the whole word.
I am using the LostFocus event, but it is not quite the same.
Anyone know of anything else?
ASKER
Actually - would the Text_Update work?
ASKER
Sorry my last comment is wrong (I was looking at a combo box)
And how do you know when the text is completed? a fixed length char? a keypress?
So i the users have to press enter you can use on keypress i it's a fixed length use textchanged and a like
if textbox.length = 10 then
your code
ebdif
So i the users have to press enter you can use on keypress i it's a fixed length use textchanged and a like
if textbox.length = 10 then
your code
ebdif
Update event raised after user press the return key
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPr essEventAr gs) Handles TextBox1.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW (Keys.Retu rn) Then
'Your Code to Update
Update()
End If
End Sub
Update event raised after user typed 10 characters
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If Len(TextBox1) = 10 Then
'Your Code
Update()
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPr
If e.KeyChar = Microsoft.VisualBasic.ChrW
'Your Code to Update
Update()
End If
End Sub
Update event raised after user typed 10 characters
Private Sub TextBox1_TextChanged(ByVal
If Len(TextBox1) = 10 Then
'Your Code
Update()
End If
End Sub
Have you checked the Validate event?
ASKER
How does the Validate event work?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.