Click here to Skip to main content
15,904,023 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

I have three textbox in C# window application
at runtime i press tab control then automatic change focus at one by one

Now i want if press enter then automatic change focus at one by one at runtime

but i don't want to work code for this

any properties for this?

if you have idea for this please help me

thanks in advance
Posted
Comments
koool.kabeer 5-Aug-10 9:21am    
show some politeness...
you would have asked like this...
"may be that could be possible with writing the code... is there a way by setting up Properties Values?...

You should not do this. UI conventions are there for a purpose. This way, every user will find it easyer to work with a new program. Imagine what havoc will be if every software used different approaches for the same actions!
So, seriousely, try to keep to the usual UI paradigms, including keys.
Personally, I will not like to use your programs. Why should I learn to use a different key to do a task, but not the key used in all the other programs?
Why tab? Because it's a standard! Why Enter? Why not Ctrl-F12 then? :-)
 
Share this answer
 
Comments
Sauro Viti 5-Aug-10 9:33am    
Reason for my vote of 5
Well said!
As far as I know, there aren't any properties for this purpose.
You would have to handle the KeyUp event for the textbox, write code to check if the Enter key is pressed and then "jump" to the next textbox by using the Focus[^] method.
 
Share this answer
 
v2
Sorry, but you'll have to write some code to get this functionality.

As well as the Focus() method already recommended you might find the Control.GetNextControl() method useful.
 
Share this answer
 
C#
private void ControlPressEnter(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar == (int)Keys.Enter)
    {
        e.Handled = true;
        SendKeys.Send("{TAB}");
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900