[求助] 关于按ESC键退出程序问题。
代码如下:'按ESC键关闭窗口
Private Sub frmDefineBank_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyValue = 27 Then
If Me.btnConfirm.Text = "更新" Then
Select Case publicfunIsSaveOrCancel()
Case MsgBoxResult.Yes
Try
Me.sqlAdapter.Update(sqlDataSource.DataSource)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "错误")
End Try
Case MsgBoxResult.Cancel
Exit Sub
End Select
Me.btnConfirm.Text = "确认"
End If
Me.Close()
End If
End Sub
窗体如下图:
在DataGridView表格的第4行,第3列中随便输入内容(这时输入的是"dd"),然后把当前单元格改变到第4行,第4列中(或其它单元格),然后按ESC键时,程序行验证出错,截图如下:
请问如何解决,谢谢!
[此贴子已经被作者于2007-11-20 10:22:52编辑过]
Ew3PwAVU.bmp
(594.05 KB)
CuTmMSni.bmp
(993.05 KB)