Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

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
Avatar of administradores
administradores

I thin it is TextChanged
Avatar of Murray Brown

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?
Actually - would the Text_Update work?
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
Update event raised after user press the return key

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) 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
Avatar of Éric Moreau
Have you checked the Validate event?
How does the Validate event work?
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial