我大概写了一下,没有测试,你可以试一下。
- Namespace FormEvents
- Public Class Form1c9f9fe44ded4c85aea9dfd6a13b03ee
- Inherits FormEventsBase
- Private m_tblDtl As SmGrid '定义一个私有字段,用来保存对右边表的引用
- Public Sub 一表多表属性_Load(sender As Object,e As System.EventArgs)
- m_tblDtl=Me.SmForm.ControlDictionary()("tblDtl")
- Dim tblSQL As SmEditTreeTable=Me.SmForm.ControlDictionary()("tblSQL")
- '添加SmEditTreeTable组合控件中SmEditTreeGrid对象的CurrentChanged事件绑定
- AddHandler tblSQL.BaseSmEditTreeGrid.CurrentChanged, AddressOf tblSQL_CurrentChanged
-
- End Sub
-
- Public Sub tblSQL_CurrentChanged(sender As Object,e As System.EventArgs)
- Dim tblSQL As SmEditTreeGrid=sender
- If tblSQL.CurrentRowData IsNot Nothing Then
- '如果当前节点没有子节点,表示是保存SQL语句的行
- If tblSQL.SelectedNode IsNot Nothing AndAlso tblSQL.SelectedNode.Children=0 Then
- Dim strSQL As String=tblSQL.CurrentRowData("SQL")
- '如果SQL语句不为空
- If Not String.IsNullOrEmpty(strSQL) Then
- '先给右边的明细表重命名,方便各个SQL都可以生效一个表属性设置
- m_tblDtl.Name=tblSQL.CurrentRowData("SQL名称")
- '根据SQL填充数据,加载表属性、标题、列宽等等
- m_tblDtl.FillAndLoadSetting(strSQL,Proj.SysDataFactory("UserDB"),False,CommandType.Text)
- End If
- End If
- End If
- End Sub
-
- End Class
- End Namespace
复制代码
|