内部合同表如图:
此主题相关图片如下:内部合同表.bmp
在表属性中的Datacolchanged事件中代码如下:
Select Case e.DataCol.Name
Case "品种_杆径"
Dim dr As DataRow = e.DataRow
Dim pr1 As DataRow
Dim pr2 As DataRow
Dim pr3 As DataRow
Dim pr4 As DataRow
Dim pr5 As DataRow
Dim pr6 As DataRow
Dim filter1 As String
filter1 = "品种_杆径 = '" & dr("品种_杆径") & "'"
pr1 = DataTables("编号列表1").Find(filter1)
If pr1 IsNot Nothing Then
dr("品种_杆径编号") = pr1("品种_杆径编号")
End If
dr("品种_ID") = dr("品种_杆径编号")
Case "品种_材质"
Dim dr As DataRow = e.DataRow
Dim pr2 As DataRow
Dim filter2 As String
filter2 = "品种_材质 = '" & dr("品种_材质") & "'"
pr2 = DataTables("编号列表2").Find(filter2)
If pr2 IsNot Nothing Then
dr("品种_材质编号") = pr2("品种_材质编号")
End If
dr("品种_ID") = dr("品种_杆径编号") & dr("品种_材质编号")
Case "品种_长度"
Dim dr As DataRow = e.DataRow
Dim pr3 As DataRow
Dim filter3 As String
filter3 = "品种_长度 = '" & dr("品种_长度") & "'"
pr3 = DataTables("编号列表3").Find(filter3)
If pr3 IsNot Nothing Then
dr("品种_长度编号") = pr3("品种_长度编号")
End If
dr("品种_ID") = dr("品种_杆径编号") & dr("品种_材质编号") & dr("品种_长度编号")
Case "品种_级别"
Dim dr As DataRow = e.DataRow
Dim pr4 As DataRow
Dim filter4 As String
filter4 = "品种_级别 = '" & dr("品种_级别") & "'"
pr4 = DataTables("编号列表4").Find(filter4)
If pr4 IsNot Nothing Then
dr("品种_级别编号") = pr4("品种_级别编号")
End If
dr("品种_ID") = dr("品种_杆径编号") & dr("品种_材质编号") & dr("品种_长度编号") & dr("品种_级别编号")
Case "品种_接箍"
Dim dr As DataRow = e.DataRow
Dim pr6 As DataRow
Dim filter6 As String
filter6 = "品种_接箍 = '" & dr("品种_接箍") & "'"
pr6 = DataTables("编号列表6").Find(filter6)
If pr6 IsNot Nothing Then
dr("品种_接箍编号") = pr6("品种_接箍编号")
End If
dr("品种_ID") = dr("品种_杆径编号") & dr("品种_材质编号") & dr("品种_长度编号") & dr("品种_级别编号") & dr("品种_接箍编号")
Case "品种_特殊要求"
Dim dr As DataRow = e.DataRow
Dim pr5 As DataRow
Dim filter5 As String
filter5 = "品种_特殊要求 = '" & dr("品种_特殊要求") & "'"
pr5 = DataTables("编号列表5").Find(filter5)
If pr5 IsNot Nothing Then
dr("品种_特殊要求编号") = pr5("品种_特殊要求编号")
End If
dr("品种_ID") = dr("品种_杆径编号") & dr("品种_材质编号") & dr("品种_长度编号") & dr("品种_级别编号") & dr("品种_接箍编号") & dr("品种_特殊要求编号")
End Select
在表属性中的DataRowAdding事件中代码如下:e.DataRow("序号") = e.DataTable.Compute("Max(序号)") + 1
合同录入窗口设计如图
此主题相关图片如下:内部合同录入设计界面.bmp
窗口的Afterload事件编码如下:
Dim lbl As WinForm.Label
lbl = e.Form.Controls("Welcome")
lbl.Text = "今 天 是 " & format(Date.Today,"yyyy年MM月dd日") & ", 大 地 石 油 机 械 公 司 欢 迎 您 !"
Dim txtBox As WinForm.TextBox
txtBox = e.Form.Controls("合同号栏")
txtBox.ReadOnly = BooleanEnum.True
txtBox = e.Form.Controls("生产数量栏")
txtBox.ReadOnly = BooleanEnum.True
txtBox = e.Form.Controls("客户新增要求录入栏")
txtBox.ReadOnly = BooleanEnum.True
Dim combobox As WinForm.ComboBox
ComboBox = e.Form.Controls("杆径栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("材质栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("长度栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("级别栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("接箍栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("特殊要求栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("甲方栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("乙方栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("客户名称栏")
ComboBox.ReadOnly = BooleanEnum.True
Dim DateTimePicker As WinForm.DateTimePicker
DateTimePicker = e.Form.Controls("交付日期栏")
DateTimePicker.ReadOnly = BooleanEnum.True
DateTimePicker = e.Form.Controls("签订日期栏")
DateTimePicker.ReadOnly = BooleanEnum.True
e.Form.Controls("内贸").Enabled=False
e.Form.Controls("外贸").Enabled=False