How to go to the next control?

B

Benson

I want to use code to move focus from the current control to the next
control (don't know the control name).
Example, there are texbox A and B, and a button. The current focus is on A.
When I press the button, the focus move from A to B with code. Somthing
like, GotoNextControl(A).

Please help
Benson.
VB2005
 
C

Cor Ligthert [MVP]

Benson,

Strange why do you not know the Control name, don't you have the source?

The next control is the control with the next tab index.

Cor
 
S

Sorcerdon

What he is saying is that every control has a tab Index property.
Set these up for every control that you want to be focused on, in the
order that you want.
Then use that index to move from one control to the next.
 
S

Sorcerdon

Is this a web application or a windows forms?
If it's windows forms, then this is rather simple.
if its a Web application, you will need to use javascript to navigate
from one control to the next using javascript's Focus() function.

let me know if you need any other help...

regards,

Sorcerdon
 
H

Herfried K. Wagner [MVP]

Benson said:
I want to use code to move focus from the current control to the next
control (don't know the control name).
Example, there are texbox A and B, and a button. The current focus is on
A. When I press the button, the focus move from A to B with code. Somthing
like, GotoNextControl(A).

Check out the form's 'SelectNextControl' method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top