Results 1 to 13 of 13

Thread: autotab in the textbox , is possible ?

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    autotab in the textbox , is possible ?

    Hi

    How can I put auto tab in textbox , when the number is equal a number (example 5), I want that It setfocus the next textbox, Is It possible ?

    Has someone function that read the table access and define the maxlen property of the text box, agree the type and length of the field ?


    thank you in advance

  2. #2
    Lively Member Pete Rosborough's Avatar
    Join Date
    May 2001
    Location
    Central NY
    Posts
    68
    How about something like this?

    Code:
    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    
        If me.text = 5 then
            txtnext.setfocus
        end if
    
    end sub
    Real programs don't eat cache.

    Pete

  3. #3
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Also you can modify this which tabs, when a user hits enter, and avoids using sendkeys.

    Code:
    Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Private Const WM_KEYDOWN = &H100
    Private Const WM_KEYUP = &H101
    
    
    Private Sub Text1_KeyPress(KeyAscii As Integer)
      If KeyAscii = vbKeyReturn Then
        KeyAscii = 0
        PostMessage Text1.hwnd, WM_KEYDOWN, vbKeyTab, 0
        PostMessage Text1.hwnd, WM_KEYUP, vbKeyTab, 0
      End If
    End Sub

  4. #4

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Cool I wrong

    Excuse me

    But I want the length the textbox, eg I want that when the user type in the textbox has maxime 5 digits ("12345") or 10 ("1234567XYX") AND WHEN to be number it get the max digits of the type number

    thank you

  5. #5
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Is this what you wanted?

    VB Code:
    1. Private Sub Text1.KeyPress(KeyAscii As Integer)
    2.   If Len(Text1.Text) > 10 Then 'Change 10 to the "maximum" number of digits allowed.
    3.     KeyAscii=0
    4.     txtSomeOtherTextBox.SetFocus
    5.   End If
    6. End Sub


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  6. #6
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    I think this is what you want, tab when user enters the max characters set for the textbox?

    Code:
    Option Explicit
    
    Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Private Const WM_KEYDOWN = &H100
    Private Const WM_KEYUP = &H101
    
    Private Sub Form_Load()
    Text1.MaxLength = 5
    End Sub
    
    Private Sub Text1_KeyPress(KeyAscii As Integer)
        If Len(Text1) = Text1.MaxLength - 1 Then
            PostMessage Text1.hwnd, WM_KEYDOWN, vbKeyTab, 0
            PostMessage Text1.hwnd, WM_KEYUP, vbKeyTab, 0
        End If
    End Sub

  7. #7

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Unhappy and this link ?

    Last edited by mutley; Jun 15th, 2001 at 10:01 AM.

  8. #8
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Or this:

    VB Code:
    1. Option Explicit
    2. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    3. Private Const WM_CHAR = &H102
    4.  
    5. Private Sub Form_Load()
    6. Text1.MaxLength = 5
    7. End Sub
    8.  
    9. Private Sub Text1_KeyPress(KeyAscii As Integer)
    10.     If Len(Text1) = Text1.MaxLength - 1 Then
    11.         SendMessage Text1.hwnd, [b]WM_CHAR[/b], vbKeyTab, 0
    12.     End If
    13. End Sub
    Last edited by Microbasic; Jun 15th, 2001 at 10:02 AM.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  9. #9
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Micro, WM_CHAR doesn't work for me

  10. #10

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    where is the property autotab ?

    Hi

    Where is the autotab property of the textbox ?

  11. #11
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Oops, I forgot. WM_CHAR is a output (or event) message. It can't be sent...

    The autotab property of a textbox is in the Forms 2.0 Library.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  12. #12

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    where is autotab of the textbox ?

    http://msdn.microsoft.com/library/of...abProperty.htm


    Where is autotab of the textbox ?

  13. #13
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402

    Post

    Right click the Toolbox, select "Microsoft Forms 2.0 Object Library", Click OK, and a new bunch of controls should appear in the toolbox. Find the control named "TextBox" in these new controls. THAT TEXTBOX has the autotab property.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width