-
Heres the code im using (in frmAdd, but it never seems to work!
Code:
frmMain.tvTreeView.Nodes.Add 2, , , "Test", 2, 2
I also tested it with
Code:
frmMain.tvTreeView.Refresh
but it still doesnt work
When I add the same code in frmMain (tvTreeView.Nodes.Add 2, , , "Test", 2, 2), it works perfectly... anyone know how I can add to a treeview from another form??
-
So you are adding a node from another form?
Try going the extremly long way:
Code:
Dim nodX As Node
Set nodX = frmMain.tvTreeView.Nodes.Add 2, , , "Test", 2, 2
nodX.Visible = True
'blah blah blah
I've never done much work with Treeviews.
-
it says syntax error, and highlights the first 2
-
Code:
Option Explicit
Private Sub Command1_Click()
' frmMain.tvTreeview.Nodes.Add 2, , , "Test", 2, 2
Dim nodX As Node
Set nodX = frmMain.tvTreeview.Nodes.Add(, , "R", "Root")
Set nodX = frmMain.tvTreeview.Nodes.Add("R", tvwChild, "C1", "Child 1")
Set nodX = frmMain.tvTreeview.Nodes.Add("R", tvwChild, "C2", "Child 2")
Set nodX = frmMain.tvTreeview.Nodes.Add("R", tvwChild, "C3", "Child 3")
Set nodX = frmMain.tvTreeview.Nodes.Add("R", tvwChild, "C4", "Child 4")
nodX.EnsureVisible
frmMain.tvTreeview.Style = tvwTreelinesText ' Style 4.
frmMain.tvTreeview.BorderStyle = vbFixedSingle
End Sub
Regards,
TheBao
-