|
-
Jun 15th, 2001, 07:46 AM
#1
Thread Starter
Fanatic Member
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
-
Jun 15th, 2001, 08:29 AM
#2
Lively Member
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 
-
Jun 15th, 2001, 08:43 AM
#3
Registered User
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
-
Jun 15th, 2001, 09:37 AM
#4
Thread Starter
Fanatic Member
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
-
Jun 15th, 2001, 09:45 AM
#5
Frenzied Member
Is this what you wanted?
VB Code:
Private Sub Text1.KeyPress(KeyAscii As Integer)
If Len(Text1.Text) > 10 Then 'Change 10 to the "maximum" number of digits allowed.
KeyAscii=0
txtSomeOtherTextBox.SetFocus
End If
End Sub
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Jun 15th, 2001, 09:46 AM
#6
Registered User
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
-
Jun 15th, 2001, 09:55 AM
#7
Thread Starter
Fanatic Member
and this link ?
Last edited by mutley; Jun 15th, 2001 at 10:01 AM.
-
Jun 15th, 2001, 09:57 AM
#8
Frenzied Member
Or this:
VB Code:
Option Explicit
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
Private Const WM_CHAR = &H102
Private Sub Form_Load()
Text1.MaxLength = 5
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Len(Text1) = Text1.MaxLength - 1 Then
SendMessage Text1.hwnd, [b]WM_CHAR[/b], vbKeyTab, 0
End If
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 .
-
Jun 15th, 2001, 10:02 AM
#9
Registered User
Micro, WM_CHAR doesn't work for me
-
Jun 15th, 2001, 10:05 AM
#10
Thread Starter
Fanatic Member
where is the property autotab ?
Hi
Where is the autotab property of the textbox ?
-
Jun 15th, 2001, 10:10 AM
#11
Frenzied Member
-
Jun 15th, 2001, 10:23 AM
#12
Thread Starter
Fanatic Member
where is autotab of the textbox ?
-
Jun 15th, 2001, 10:27 AM
#13
Frenzied Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|