不行啊,报错:"Private object modules cannot be used in public object modules as parameters or return types for public procedures, as public data members,or as fields of public user defined types"
只要在控件内写一个方法就可以了.
Public Function TransferTree() As TreeView
Set TransferTree = TreeView1
End Function
'在窗体中调用.
Dim nodx As Node
Set nodx = UserControl11.TransferTree.Nodes.Add(, , "AA", "ADFSADF")
Set nodx = UserControl11.TransferTree.Nodes.Add(, , "CC", "ASF")
Set nodx = UserControl11.TransferTree.Nodes.Add(, , "CCC", "AFASDF")