Dim dataname As String
dataname="Tab_" & e.Form.Name
Dim tab= e.Form.Controls(dataname).Basecontrol
Dim dt As DataTable=DataTables("Z001分类编码方案")
Dim dt1 As DataTable=DataTables("Z002菜单生成")
Dim gz As String = dt.DataRows(0)("规则长度")
For Each p As object In tab.TabPages
Dim menuStrip As new System.Windows.Forms.MenuStrip()
menustrip.Name = p.Name
Dim ft As String= "(\',\' + [窗口名称] + \',\') Like \'%," & p.text & ",%\'"
For Each dr As DataRow In dt1.Select(ft,"编码规则")
If dr.IsNull("规则长度") = False AndAlso dr("规则长度").Length = val(gz(0)) Then
Dim tsmi As new System.Windows.Forms.ToolStripMenuItem
tsmi.name = dr("编码规则")
tsmi.Text = dr("编码名称")
menuStrip.Items.Add(tsmi)
\'If dr("是否末级") =True Then
\'tsmi.Enabled = False
\'End If
AddHandler tsmi.Click, AddressOf menu_Click
Functions.Execute("menusetup",tsmi,dt1,gz)
End If
Next
P.Controls.add(menuStrip)
Next