这么改一下:
Dim Result As DialogResultStatic i As IntegerIf i = 0 Then i = 1 Result = MessageBox.Show("Confirm Quit?", "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result <> DialogResult.Yes Then i = 0 e.Cancel = True End IfEnd If