'窗口变量,编辑状态
Dim bianji As String=e.Form.Controls("bianji").text
With Tables("yonghu")
Dim yhdm As String=.current("yhdm")
Dim yhmc As String=.current("yhmc")
If yhdm="" Or yhmc="" Then
If yhdm="" Then
If MessageBox.Show(.Cols("yhdm").Caption+"不能为空!","警告",MessageBoxButtons.ok,MessageBoxIcon.Question) = DialogResult.ok Then
End If
'新增或者修改时默认选中第一行第一列,并进入编辑状态
e.Form.Controls("you1").BaseControl.Row=0
e.Form.Controls("you1").BaseControl.Col=1
e.Form.Controls("you1").BaseControl.StartEditing
'新增或者修改时默认选中第一行第一列,并进入编辑状态
ElseIf yhmc="" Then
If MessageBox.Show(.Cols("yhmc").Caption+"不能为空!","警告",MessageBoxButtons.ok,MessageBoxIcon.Question) = DialogResult.ok Then
End If
'新增或者修改时默认选中第一行第一列,并进入编辑状态
e.Form.Controls("you1").BaseControl.Row=1
e.Form.Controls("you1").BaseControl.Col=1
e.Form.Controls("you1").BaseControl.StartEditing
'新增或者修改时默认选中第一行第一列,并进入编辑状态
End If
Else
Dim dr As DataRow
dr = .DataTable.Find("yhdm = '"&yhdm&"'")
If dr IsNot Nothing Then
MessageBox.Show(.Cols("yhdm").Caption+yhdm+"已经存在!","警告")
'新增或者修改时默认选中第一行第一列,并进入编辑状态
e.Form.Controls("you1").BaseControl.Row=0
e.Form.Controls("you1").BaseControl.Col=1
e.Form.Controls("you1").BaseControl.StartEditing
'新增或者修改时默认选中第一行第一列,并进入编辑状态
Else
.Current.Save() '保存后禁止编辑 其他相应按钮禁用
.AllowEdit = False
e.Form.Controls("baocun").Enabled =False '设置按钮状态
e.Form.Controls("quxiao").Enabled =False
e.Form.Controls("xinzeng").Enabled =True
e.Form.Controls("xiugai").Enabled =True
e.Form.Controls("shanchu").Enabled =True
e.Form.Controls("shuaxin").Enabled =True
e.Form.Controls("daochu").Enabled =True
e.Form.Controls("dayin").Enabled =True
e.Form.Controls("shezhi").Enabled =True
e.Form.Controls("guanbi").Enabled =True '设置按钮状态
e.Form.Controls("bianji").text="0" '窗口变量,编辑状态
End If
End If
End With