Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

URGENT!  VB.NET  DatagridView.KeyUp event not working properly

Posted on 2013-01-10
2
Medium Priority
?
1,164 Views
Last Modified: 2013-01-11
Oracle Forms allows a user to execute a search or run a query when a user finishes typing a value in a column in a grid.  The user can press F8 on the keyboard to initiate the search based on the DataGrid's current column value.

I tried to use the DataGridView.KeyUp event to mimic the same function but the event does activate at the right time.  In fact, I have to click out of the column then click once, then hit F8.

Here is a snippet of the code I used

Select Case e.Keycode
      Case Keys.F8
             MyTableAdapter.Fill(Me.DataSet1.Table1, CurrentColumnValue)
End Select

After I type the last letter in the column and press F8, nothing happens-- but if I move to the next column and then click back on the original column, F8 works.

What am I doing wrong?

Thanks
0
Comment
Question by:Eric Burton
2 Comments
 
LVL 14

Accepted Solution

by:
quizwedge earned 2000 total points
ID: 38766315
Check out http://social.msdn.microsoft.com/Forums/en/winformsdatacontrols/thread/db486d50-48f3-405d-bc7a-ad3720d4dd57 There are both C# and VB solutions, though the solution from tbar68 (close to the bottom of the page) looks rather simple. You'd have to modify it a bit to catch the F8 key and the delete key.
0
 
LVL 7

Expert Comment

by:HaiFai
ID: 38766373
Hi

I have used this code to cap keys anywhere in form
  Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
        Select Case keyData
            Case Keys.F2
                MsgBox("f2")
            Case Keys.F3
                MsgBox("f3")
            Case Keys.Escape
                MsgBox("esc")
            Case Else
                Return MyBase.ProcessCmdKey(msg, keyData)
        End Select
        Return True
    End Function

Open in new window

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
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

876 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