if you want to configure enter key to move to next control in .NET then use following technique.
Set KeyPreview property of the form to "True"
Trap Key_down event of form and check if enter key was pressed. if then pass the focus to next control. code looks like below.
private void Form1_KeyDown ( object sender, KeyEventArgs e )
{
if ( e.KeyCode == Keys.Return )
{
Control c = GetNextControl ( ActiveControl, true ) ;
c.Focus( ) ;
}
}
.The ActiveControl property returns the reference of the control that is currently selected. The GetNextControl( ) method returns the control next to the specified control in tab order. The focus is set on the next control using the Focus( ) method.
Thursday, March 03, 2005
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment