2016-11-17 1 views
0

하나의 양식이 있습니다.Esc 키를 눌러 디버깅 중지

Private Sub Form2_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown 
    Select Case e.Key 
       Case Key.Escape 
        Me.close() 
       Case Else 
        ' do nothing 
    End Select 
End Sub 

희망이 : 나는 또한 디버깅 그만 둘 여기에 버튼을 클릭하여 종료하고 싶은 Esc 키를 눌러 양식을 닫으려면 여기

Private Sub Form2_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing 

    Select Case MessageBox.Show("Are you sure you want to exit?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) 
     Case Windows.Forms.DialogResult.Yes 
      Application.Exit()                    ' Close the form and also debugging 
      'nothing to do here the form is already closing 
     Case Windows.Forms.DialogResult.No 
      e.Cancel = True 'cancel the form closing event 
      'minimize to tray/hide etc here 
    End Select 




End Sub 

답변

0

는 하나 개의 간단한 솔루션입니다 코드입니다 도움.

관련 문제