For j As Integer = 1 To 5
If e.Form.Controls("TextBox" & j).Text = "" Then
msgbox("请输入完整的数据")
Return
End If
Next
Dim Result As DialogResult
Result = MessageBox.Show("您是否确定增加该数据,是不是?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
Dim str() As String = {"桌脚","桌面","立水","长提"}
For i As Integer = 0 To 3
Dim r As Row = Tables("BOM").AddNew
r("部件名称") = str(i)
r("外观_长") = e.Form.Controls("TextBox1").Text
r("外观_宽") = e.Form.Controls("TextBox2").Text
r("外观_厚") = e.Form.Controls("TextBox3").Text
r("产品名称") = e.Sender.Text
Select Case str(i)
Case "桌面"
r("长") = r("外观_长")
r("宽") = r("外观_宽")
r("数量") = val(e.Form.Controls("TextBox4").Text)
Case "桌脚"
r("长") = 80
r("宽") = 80
r("厚") = r("外观_厚")
r("数量") = val(e.Form.Controls("TextBox5").Text)
Case "立水"
'根据自己的算法实现
Case "连杆"
'根据自己的算法实现
End Select
Next
Else
MessageBox.Show("想好了再来.","提示")
End If
DataTables("BOM").Save()