datacolchanged事件,写代码
Select Case e.DataCol.name
Case "快递公司名称","省","重量"
Dim fdr As DataRow = DataTables("报价单").find("目的地='" & e.DataRow("省") & "' and 快递公司名称='" & e.DataRow("快递公司名称") & "'")
If fdr Is Nothing Then
e.DataRow("单价") = Nothing
Else
If e.DataRow("重量") >= 5 AndAlso e.DataRow("重量") <= 60 Then
e.DataRow("单价") = fdr("重量段1")
ElseIf e.DataRow("重量") >= 61 AndAlso e.DataRow("重量") <= 180 Then
e.DataRow("单价") = fdr("重量段2")
ElseIf e.DataRow("重量") >= 181 AndAlso e.DataRow("重量") <= 600 Then
e.DataRow("单价") = fdr("重量段3")
ElseIf e.DataRow("重量") >= 601 Then
e.DataRow("单价") = fdr("重量段4")
End If
End If
End Select