标色部分获取不到刚新增加的行
Dim jsxmbh As WinForm.TextBox = e.Form.Controls("TextBox1") '工程编号
Dim dxgcbh As WinForm.TextBox = e.Form.Controls("TextBox2") '单项工程编号
Dim jsxm As WinForm.DropDownBox = e.Form.Controls("DropBox1") '建设项目
Dim dxgc As WinForm.DropDownBox = e.Form.Controls("DropBox2") '单项工程
Dim jsxmdm As WinForm.TextBox = e.Form.Controls("TextBox3") '建设项目代码
Dim jclb As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim jccs As WinForm.CheckedComboBox = e.Form.Controls("CheckedComboBox1") '检测参数
Dim zgdw As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox1") '暂估吨位
Dim xmzt As WinForm.ComboBox = e.Form.Controls("ComboBox3") '项目状态
Dim xmgldw As WinForm.TextBox = e.Form.Controls("TextBox4")
Dim lxfs As WinForm.TextBox = e.Form.Controls("TextBox5")
Dim jcxmz As WinForm.ComboBox = e.Form.Controls("ComboBox4")
Dim str1 As String = dxgc.Value
str1 = str1.Replace("*","[*]")
str1 = str1.Replace("%","[%]")
str1 = str1.Replace("#","[#]")
'条件判断
If jsxm.Value Is Nothing
MessageBox.Show("建设项目未输入","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Return
Else
If jsxmbh.Value Is Nothing OrElse dxgcbh.Value Is Nothing '编号为空
If jsxmbh.Value Is Nothing '新项目
'新增工程表行
Dim zdr1 As DataRow = DataTables("无损_工程主表").AddNew
zdr1("工程名称全称") = jsxm.Value
'获取新增行编号
Dim dr1 As DataRow = DataTables("无损_工程主表").Find("工程名称全称 = '"& jsxm.Value &"'")
If dr1 IsNot Nothing
jsxmbh.Value = dr1("工程编号")
End If
End If
If dxgcbh.Value Is Nothing
'获取新增单项工程行
Dim zdr1 As DataRow = DataTables("无损_单项工程").AddNew
zdr1("工程编号") = jsxmbh.Value
zdr1("单项工程") = dxgc.Value
zdr1.Save
'获取新增单项工程行编号
Dim dr4 As DataRow = DataTables("无损_单项工程").Find("工程编号 = '"& jsxmbh.Value &"' and 单项工程 = '"& str1 &"'")
If dr4 IsNot Nothing
dxgcbh.Value = dr4("单项工程编号")
dr4.Save
End If
End If
If jsxmbh.Value Is Nothing OrElse dxgcbh.Value Is Nothing
MessageBox.Show("编号为空,请联系管理员","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Return
End If
End If
If jsxm.Value IsNot Nothing AndAlso jsxmbh.Value IsNot Nothing AndAlso dxgcbh.Value IsNot Nothing
Dim dr3 As DataRow = DataTables("无损_工程产值表_2020").AddNew
Dim dr4 As DataRow = DataTables("无损_单项工程").Find("工程编号 = '"& jsxmbh.Value &"' and 单项工程 = '"& str1 &"'")
dr3("编号_工程名称") = jsxmbh.Value
dr3("编号_单项工程") = dxgcbh.Value
dr3("建设项目代码") = jsxmdm.Value
dr3("检测类别") = jclb.Value
dr3("检测参数") = jccs.Value
dr3("暂估吨位") = zgdw.Value
dr3("项目状态") = xmzt.Value
dr3("检测项目组") = jcxmz.Value
dr3.Save
dr4("项目部_单位名称") = xmgldw.Value
dr4("项目部_合并联系人和电话") = lxfs.Value
dr4.Save
e.Form.Close
Else
MessageBox.Show("请重新执行确认操作","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
End If