0

Hello everybody,

I have a question about vb.Net.
I really hope that you can help me with it.

I've got a form with several textboxes.
When the user gives input in an textbox and presses the tabkey,
then the input in the textbox must be checked and complement with data.
Seems to me that this must be a simple thing, but it will not work and i can't find anathing about it.

The code must be something like this:
If (code for user presses the tabkey) and ChkStart1.IsMatch(txtStart.Text) Then
Start = Me.txtStart.Text & ".000"
End If

Can anabody help me with this.

Thanks in advance,

Sneaky Pete

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Pride
0
  1. Goto your form's property window and make sure 'KeyPreview' is true.
  2. Goto your form's events windows and make an event for 'KeyUp'.
  3. Insert the following code into the event subroutine you made in step 2.

    If e.KeyCode = Keys.Tab And ChkStart1.IsMatch(txtStart.Text) Then
        Start = Me.txtStart.Text & ".000"
    End If
    
  4. In the end it should look something like this:

    Public Class MyForm
        Public Start As String
    
        Private Sub MyForm_KeyUp(sender As Object, e As KeyEventArgs) Handles MyBase.KeyUp
            If e.KeyCode = Keys.Tab And ChkStart1.IsMatch(txtStart.Text) Then
                Start = Me.txtStart.Text & ".000"
            End If
        End Sub
    End Class
    

Edited by Pride

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.