Click here to Skip to main content
15,909,939 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to add a shortcut (ctrl+p) for the button Print in the PrttPreview Control form?
Posted
Updated 20-Jul-14 20:09pm
v2

In your form keydown event use following code..
This is in VB.net

VB
If e.Control Then
     If e.KeyCode = Keys.P Then
         Button1.PerformClick()
     End If
 End If

button1 is button name.
 
Share this answer
 
v3
Comments
nilesh sawardekar 20-Jul-14 15:43pm    
Why downvoted?. we are not here to waste time of us and others..we just give logic to use..so kindly keep at least some respect.
aciobanita constantin 21-Jul-14 2:15am    
i didn't down-voted. you didn't understand my questions. Add Ctrl+P functionality in the PrinPreview Control
nilesh sawardekar 21-Jul-14 5:46am    
after pressing ctrl+p, what should happen..plz remove downvoting..
Drag An Drop "PrintDailoG" And Set Proparty "AllowCurrentPage = True"

And After Cs File Code:


C#
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
       {
           
           if ((Keys.Control | Keys.P) == keyData)
           {
               PrintForm.ShowDialog(this);
           }


           return base.ProcessCmdKey(ref msg, keyData);
       }
 
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