Solved

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

Posted on 2013-01-10
2
1,015 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

18 Experts available now in Live!

Get 1:1 Help Now