Home All Groups Group Topic Archive Search About

How to go to the next control?

Author
15 Jan 2007 2:49 AM
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

Author
15 Jan 2007 6:12 AM
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

Show quoteHide quote
"Benson" <benson***@yahoo.com.hk> schreef in bericht
news:eo$M3%23EOHHA.780@TK2MSFTNGP03.phx.gbl...
>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
>
Author
15 Jan 2007 3:47 PM
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.


Benson wrote:
Show quoteHide quote
> 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
Author
15 Jan 2007 3:55 PM
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


Sorcerdon wrote:
Show quoteHide quote
> 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.
>
>
> Benson wrote:
> > 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
Author
15 Jan 2007 10:11 PM
Herfried K. Wagner [MVP]
"Benson" <benson***@yahoo.com.hk> schrieb:
>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.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>