Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
Windows Forms
Controling a group of Buttons using Arrow Keys
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="akashdeep, post: 161864, member: 47380"] Okay, I got a partial solution by digging deep in the forum. Here's the code: [CODE] Protected Overrides Function ProcessDialogKey(ByVal keyData As System.Windows.Forms.Keys) As Boolean Select Case keyData Case Keys.Left Select Case Me.ActiveControl.Name Case "Button1" Button2.Focus() Case "Button2" Button1.Focus() Case "Button3" Button4.Focus() Case "Button4" Button3.Focus() Case Else Return False End Select Case Keys.Right Select Case Me.ActiveControl.Name Case "Button1" Button2.Focus() Case "Button2" Button1.Focus() Case "Button3" Button4.Focus() Case "Button4" Button3.Focus() Case Else Return False End Select Case Keys.Up Select Case Me.ActiveControl.Name Case "Button1" Button3.Focus() Case "Button2" Button4.Focus() Case "Button3" Button1.Focus() Case "Button4" Button2.Focus() Case Else Return False End Select Case Keys.Down Select Case Me.ActiveControl.Name Case "Button1" Button3.Focus() Case "Button2" Button4.Focus() Case "Button3" Button1.Focus() Case "Button4" Button2.Focus() Case Else Return False End Select Case Else Return False End Select Return False End Function [/CODE] But, I'm faced with a new problem. I need the Tab to work to cycle through controls as usual. Due to the ProcessDialogKey Function, the Tab function doesn't work. I changed the layout a bit. Now the form loads into a TextBox. Ideally, pressing Tab should shift focus to the START button as it is next in terms of TabIndex. But because of ProcessDialogKey, it does not. Is there a way to keep Tab key in ProcessDialogKey? Can anyone please suggest a way out? Thanks! [ATTACH]3817.vB[/ATTACH] [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
Windows Forms
Controling a group of Buttons using Arrow Keys
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom