Click here to Skip to main content
15,911,360 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a crystal report.....i want any shortcut key that can auto-maticaly print a report....??
How can i set a short-cut key ?? it is possible ???
Posted

Hi.
You can catch keys with the Keypress event.
example:
VB
Private Sub Form1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress

End Sub

Then you can work with e.KeyPress...

Or maybe the MSDN-Help can help you:
System.Windows.Forms.Keypresseventargs




Regards,
The.Z
 
Share this answer
 
v3
Set KeyPreview=True for your form, so that key pressed over any controls gets to the Form1_KeyPress.

VB
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
  If e.Control And e.KeyCode = Keys.P Then
    'here goes your code to print the report
    CrystalReportViewer1.PrintReport()
  End If
End Sub
 
Share this answer
 
I like to create shortcut keys by using menu objects and then hiding them by setting visibility to false. You can setup the menuItem with whatever shortcut key(s) you want and add the code you want it to execute in the click event.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900