Dim htmc As WinForm.TextBox = e.Form.Controls("合同名称")
Dim khmc As WinForm.TextBox = e.Form.Controls("客户名称")
Dim lxrq As WinForm.DateTimePicker = e.Form.Controls("立项日期")
Dim spzt As WinForm.TextBox = e.Form.Controls("审批状态")
Dim txr As WinForm.TextBox = e.Form.Controls("填写人")
Dim xmjd As WinForm.TextBox = e.Form.Controls("项目阶段")
Dim xmms As WinForm.TextBox = e.Form.Controls("项目描述")
Dim xmmc As WinForm.TextBox = e.Form.Controls("项目名称")
Dim xmsyr As WinForm.TextBox = e.Form.Controls("项目所有人")
Output.Show(0)
Dim HasError As Boolean
If xmmc.Value = "" Then
e.Form.Controls("项目名称").Error = "必须输入项目名称!"
HasError = True
Else
e.Form.Controls("项目名称").Error = ""
End If
If khmc.Value = "" Then
e.Form.Controls("合同名称").Error = "必须选取合同名称!"
HasError = True
Else
e.Form.Controls("合同名称").Error = ""
End If
If lxrq.Value = "" Then
e.Form.Controls("立项日期").Error = "必须输入立项日期!"
HasError = True
Else
e.Form.Controls("立项日期").Error = ""
End If
If xmsyr.Value = "" Then
e.Form.Controls("项目所有人").Error = "必须填写项目所有人!"
HasError = True
Else
e.Form.Controls("项目所有人").Error = ""
End If
Output.Show(1)
If HasError = False Then '如果没有输入错误,则保存
Dim pr As DataRow = DataTables("项目").AddNew
pr("项目名称") = xmmc.Value
pr("客户名称") = khmc.Value
pr("合同名称") = htmc.Value
pr("项目阶段") = xmjd.Value
pr("立项日期") = lxrq.Value
pr("审批状态") = spzt.Value
pr("填写人") = txr.Value
pr("项目所有人") = xmsyr.Value
pr("项目描述") = xmms.Value
Forms("立项").Close
Forms("项目").Show
End If