473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Capture Shift-Tab in Datagrid

I've got this working but I've got to wonder if there's not a better
way.

I'm capturing the tab and shift-tab keys in a datagrid and doing
custom processing.

Also, the form designer gets weird when I put in the line:

Me.FileList = New FileListDataGrid(AddressOf HandleTabKey, _
AddressOf HandleShiftTabKey)

It says: "The variable 'FileList' is either undeclared or was never
assigned." It lists many errors but the app runs ok. The FileList
datagird disappears from the designer.

The equivalent line with an empty constructor behaves normally.
Here's the code for the datagrid that handles the shift-tab key.

Thanks Much,
Gene H.

================================================== ==============

Public Class FileListDataGrid
Inherits DataGrid

Private mHandleTabKey As delegateHandleTabKey
Private mHandleShiftTabKey As delegateHandleShiftTabKey

Public Sub New()
MyBase.new()
End Sub

Public Sub New(ByVal handleTabKey As delegateHandleTabKey, _
ByVal handleShiftTabKey As delegateHandleShiftTabKey)
MyBase.new()
mHandleTabKey = handleTabKey
mHandleShiftTabKey = handleShiftTabKey
End Sub

Protected Overrides Function ProcessCmdKey(ByRef msg As _
System.Windows.Forms.Message, ByVal keyData As _
System.Windows.Forms.Keys) As Boolean
Static shiftFlag As Boolean 'true if last key was shift

If msg.WParam.ToInt32() = CInt(Keys.Left) Or _
msg.WParam.ToInt32() = CInt(Keys.Right) Then
Return True 'disable left and right arrow keys
End If

If msg.WParam.ToInt32() = CInt(Keys.Tab) Then
If shiftFlag Then
mHandleShiftTabKey() 'shift tab key
shiftFlag = False
Else
mHandleTabKey() 'tab key
End If
Return True
End If

If msg.WParam.ToInt32() = CInt(Keys.ShiftKey) Then
shiftFlag = True
Else
shiftFlag = False
End If

Return MyBase.ProcessCmdKey(msg, keyData)
End Function
End Class
Nov 20 '05 #1
0 1440

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mr. x | last post by:
Hello, I want to capture the event when the <ctrl> key is pressed. How can I do that ? Thanks :)
5
by: Alex Stevens | last post by:
Hi All, I'm writing a launcher program which checks for updates and copies them down to the client. However, I would like the user to be able to modify the settings for the launcher. As this...
43
by: Mehta Shailendrakumar | last post by:
Hello, Can anyone suggest me operator to perform arithmetic shift in C? May it be for a perticular compiler. Thank you in advance. Regards, Shailendra
7
by: Csaba Gabor | last post by:
I'd like to detect the shift key when a button is "clicked" in Firefox/Mozilla. If the button is clicked with the mouse, no problem. However, if the onclick event is keyboard originated, then my...
4
by: Taoge | last post by:
Hi, all When we click or select Print in IE, a print windows pop-up, is there anyway to capture this message and get the information of the print window (i.e. pages ,paper,defualt printer,...) and...
4
by: t3projects | last post by:
I'm working on controlling a windows media player I'm trying to figure out how to control it with keys like CTRL+SHIFT+P to play it. The problem is that I don't know how to capture all three at the...
3
by: GS | last post by:
If I were to capture enter key on keyup event of an GUI object like comboBox box, How do I avoid killing ctrol-c, controlv, controlx, shift-insert, shiftdelete, contrl-insert
0
by: amyl | last post by:
I have a 32 bit number "3515261219" that really contains four 8 bit numbers. 11010001 10000110 10100001 00100011 Is there a way to capture the bits that are shifted out of the number when you...
0
by: j101 | last post by:
I am attempting to set up Q Capture on RH Linux (x86_64) using DB2 9 fp2, but there seems to be a general problem loading a specify MQ shared library "/opt/mqm/lib/libmqm_r.so". I have MQ v6...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.