BeforeAddDataRow 根本不知道它的父亲是谁。
或者你这样写
Dim d As Row = Tables("从业人员健康检查登记表").Current
If d IsNot Nothing Then
Dim crs As List(of DataRow) = d.DataRow.GetChildRows("从业人员健康检查表")
Dim n As Integer = crs.Count
If n >= d("体检人数") Then
e.Cancel = True
Else
e.Cancel = False
End If
End If