Binding keys within the form

Anyone know how to bind for say the "esc" key to a function?
[70 byte] By [me113] at [2007-12-28]
# 1

Code Snippet

'make sure you set your forms keypreview property to true.

Me.keypreview=true

Private Sub frmMain_KeyDown(ByVal sender As Object, ByVal EventArgs As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

Select Case EventArgs.KeyCode

Case Keys.Escape

me.close 'function to call

End Select

End Sub

element109 at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2
Thanks... THat works great!
me113 at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Language...