|
-
Aug 21st, 2003, 01:49 AM
#1
Thread Starter
New Member
which way to "autotab" from textbox ?
my screen have some textbox, and I want to goto next textbox when I press ENTER (finish input) on one textbox (same textbox in VB6 Mircosoft Forms 2.0 object library)
thanks any help!
a beginner
-
Aug 21st, 2003, 05:14 AM
#2
VB Code:
Private Sub TextBox1_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
TextBox2.Focus()
End If
End Sub
This world is not my home. I'm just passing through.
-
Aug 21st, 2003, 05:45 AM
#3
Thread Starter
New Member
thank you, but ...
if I have 100 textbox, so I must write 100 event like this!
-
Aug 21st, 2003, 05:59 AM
#4
Member
Don´t think you need 100 events like that.
You got one event which feels if the enter button is pressed down.
If enterbutton is pressed down. Just goto next textbox.
quote:
If e.KeyCode = Keys.Enter Then
TextBox2.Focus()
End If
--------------------
To something like...
if e.KeyCode = Keys.Enter Then
if TextBox1.Focus()=True Then
TextBox2.Focus()
elseif TextBox2.Focus()=True Then
TextBox3.Focus()
elseif...
...
...
Endif
Think you can do something like that
-
Aug 21st, 2003, 07:12 PM
#5
I wonder how many charact
You only need one event... you also don't need to an IF else for 100 scenarios...
Set the Form's keyPreview property to True..either in code or using the Properties window...
and try this:
VB Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Windows.Forms.Keys.Enter Then
Me.SelectNextControl(Me.ActiveControl, True, True, True, True)
'selectnextcontrol(control to move from, forward=true back=false,tabstopsonly = true or false, stop at nested controls=true, go back to beginning if at end=true)
End If
End Sub
Last edited by nemaroller; Aug 21st, 2003 at 07:25 PM.
-
Aug 21st, 2003, 10:23 PM
#6
Lively Member
-
Aug 21st, 2003, 10:40 PM
#7
I wonder how many charact
I wouldn't rely on SendKeys...
You have few choices, SendWait probably being your best bet if you were to implement that solution. In that way, you can be 99.9% sure the message will be processed properly.
Best to rely on the parent container to handle the messaging.
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
|