Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How disable Shift+Tab key

Posted on 2006-11-17
5
Medium Priority
?
350 Views
Last Modified: 2008-02-01
Using .NET 1.1, Windows Forms

I have disabled the Tab key with the following code but how do I disable the Shift+Tab Key?

Thanks

San

 Protected Overrides Function ProcessDialogKey(ByVal keyData As System.Windows.Forms.Keys) As Boolean
        If Not _dt Is Nothing Then

            If keyData = Keys.Tab Then
                Return True
            End If

            Return MyBase.ProcessDialogKey(keyData)
        End If
    End Function
0
Comment
Question by:Sanmarie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 10

Assisted Solution

by:Kinger247
Kinger247 earned 600 total points
ID: 17968305
Could try:

Public Class Form2
    Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.KeyPreview = True
    End Sub

    Private Sub Form2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.Shift And e.KeyData.Tab Then
            e.Handled = True
        End If
    End Sub
End Class
0
 

Author Comment

by:Sanmarie
ID: 17968513

Thanks but your suggestion doesn't work.
If I press shift by itself or Tab by itself, then it works. But shift+ tab is still enabled.

San
0
 
LVL 6

Accepted Solution

by:
riyazthad earned 800 total points
ID: 17968752
It will work only if your all controls tab stop is set to False.

Now try this code

    Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Tab And e.Shift Then
            Me.Text = "Tab +Shift"
        Else
            Me.Text = "Tab Only"
        End If
    End Sub
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 600 total points
ID: 17969195
You can disable both Tab and Shift-Tab with this:

Public Class Form1
    Inherits System.Windows.Forms.Form

    Protected Overrides Function ProcessTabKey(ByVal forward As Boolean) As Boolean
        Return True
    End Function

End Class
0
 

Author Comment

by:Sanmarie
ID: 17976179
ProcessTabKey and keydown worked

Thanks all

San
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question