Solved

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

Posted on 2013-01-10
2
1,031 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:eq2006
2 Comments
 
LVL 14

Accepted Solution

by:
quizwedge earned 500 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now