PrintPreviewDialog

ALX

Well-known member
Joined
Nov 16, 2005
Messages
253
Location
Columbia, SC
Programming Experience
10+
I'm trying to handle the KeyDown event for the PrintPreviewDialog without success.
'Have done all of the usual... The PrintPreviewDialog has been added to the form as "WithEvents"... The event handling routine ...
VB.NET:
Private Sub PrintPreviewDialog1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles PrintPreviewDialog1.KeyDown

        If e.KeyCode = Keys.Escape Then PrintPreviewDialog1.Close()
    End Sub
...But it doesn't catch the event. I added
VB.NET:
PrintPreviewDialog1.KeyPreview = True
thinking that would help... No such luck! MSDN doesn't provide any insights....
Any ideas ???
 
Use the KeyUp event instead, also KeyPreview=True. Tested and works.
 
Back
Top