Click here to Skip to main content
15,997,860 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i have 2 text boxes that one of them(textbox1) can accept some characters. when i enter characters to the text box1, by press "ENTER", characters move to another text box(textbox2). what shall i do? which event of textbox1?
Posted

The simple answer is: "Don't"

The "normal" action of ENTER is to accept data and close, not to copy data around a form, and subverting that behaviour is a bad idea as it confuses users: they expect a behaviour with all their other applications and yours "doesn't work" - this can result in users not wanting to use your app, purely because other apps "don't do it like that".

Find another key, and just add a "transfer" button they can click if they want - then use the Form to override the ProcessCmdKey method, after setting the Form.KeyPreview property to true.
 
Share this answer
 
 
Share this answer
 
thanks from all of you
if (e.KeyChar == (char)13)
 
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