Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Some people are wise and some are other-wise.
  • *Experts*
Posted

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.

  • *Experts*
Posted

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

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...