If Forms("商品信息").opened Then
Dim trv As WinForm.TreeView = Forms("商品信息").controls("treeview1")
If trv.SelectedNode IsNot Nothing Then
Dim nd = trv.SelectedNode
If nd.Level = 0 Then
Dim tr As Row = Tables("商品明细表").Current
Dim dr As DataRow = nd.DataRow '获取生成此节点的DataRow
tr("商品类别") = dr("商品类别")
tr("类别编号") = dr("编号")
e.form.controls("商品类别").text = dr("商品类别")
End If
End If
End If
Tables("商品明细表").AddNew
Tables("商品明细表").AllowEdit=True