sizer Posted March 31, 2003 Posted March 31, 2003 Can anyone help me! I'm trying to force ENTER key to act like TAB key ,but when my cursor enters combobox and I press ENTER then cursor jumps to third control (instead second)! Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean Dim ctl As Control = Me.ActiveControl If keyData = keyData.Enter Then MessageBox.Show(keyData) ' keyData is 13 13 when ENTER is pressed on ComboBox Me.SelectNextControl(ctl, True, True, True, True) End If End Function Quote Some people are wise and some are other-wise.
*Experts* Volte Posted March 31, 2003 *Experts* Posted March 31, 2003 Are your TabIndex set up correctly? The tabs only follow the order that the controls' TabIndexes are set to. If the third control has the TabIndex of '2' and the first control of '1', then the order of tab will be first control -> third control. You need to change it manually. Click 'View -> Tab Order...' to go into TabIndex setting mode, where you can click the controls in the order that you want them. Quote
*Experts* Bucky Posted March 31, 2003 *Experts* Posted March 31, 2003 This is a function, so you need to Return True to indicate that the key was handled. Your If statement should look like this: If keyData = keyData.Enter Then MessageBox.Show(keyData) ' keyData is 13 13 when ENTER is pressed on ComboBox Me.SelectNextControl(ctl, True, True, True, True) Return True End If Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
sizer Posted March 31, 2003 Author Posted March 31, 2003 thanks Bucky!!! Quote Some people are wise and some are other-wise.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.