做两个,剩下的你自己写一下。把代码写到datacolchanged事件
Select Case e.DataCol.name
Case "选择树种","实测胸径","实测树高"
If e.DataRow.IsNull("选择树种") = False AndAlso e.DataRow.IsNull("实测胸径") = False AndAlso e.DataRow.IsNull("实测树高") = False Then
Select e.DataRow("选择树种")
Case "马尾松"
Dim fdr As DataRow = DataTables("形高值").find("胸径 = '" & e.DataRow("实测胸径") & "' and 树高 = '" & e.DataRow("实测树高") & "'")
If fdr IsNot Nothing Then
e.DataRow("单株材积") = fdr("材积")
End If
Case "杉木"
e.DataRow("单株材积") = 0.000058777042 * e.DataRow("实测胸径") ^ 1.9699831 * e.DataRow("实测树高") ^ 0.89646157
Case ""
Case ""
End Select
End If
End Select