Move Textbox focus Automatically

Samir_ibrahim

New member
Joined
Sep 6, 2008
Messages
3
Programming Experience
10+
Hi all,

I am new to Vb.Net, I am professional in Foxpro and having good knowledge about vb6 and I have a lot of questions regarding VB.Net so prepare your self :)

I know in vb6 I had to code the Keypress event for every Textbox on the Form in order to move focus from Textbox to another when pressing the ENTER key.

I noticed that this beaviour is still exist in VB.Net Unless there is a property or something to Set.

Can I move the focus between Textbox on a form when pressing ENTER without putting a code in each keypress of each textbox?

TIA.
Samir Ibrahim
 
Can I move the focus between Textbox on a form when pressing ENTER without putting a code in each keypress of each textbox?
No.

Just in case you didn't know, the default key for this behaviour in Windows operating system is the TAB key.
 
Hi John,
Just in case you didn't know, the default key for this behaviour in Windows operating system is the TAB key.
Yes, I aware of that, but in VFP it is available so I wondered if it exist in VB.Net also.

I had found this link Enter Instead of Tab | Duncan Mackenzie.NET
But the example keeps giving me warning about infinite loop, and when pressing Enter the code works, but when pressing TAB the form hangs up and it give this error

VB.NET:
System.StackOverflowException was unhandled  InnerException: 
{Property evaluation failed.}

Can you guide me about it?
 
Select all your textbox controls in Designer, in Properties window switch to "Events", locate KeyUp event and doubleclick it. In the generated event handler add this code:
VB.NET:
If e.KeyCode = Keys.Enter Then Me.ProcessTabKey(True)
 
Thank you very much for your answer which solves my problem is smooth way.

is there a rate or this answer was helpful or problem is solved button?

Thanks a lot :)

Samir Ibrahim
 
Back
Top