Results 1 to 5 of 5

Thread: Arrrgggghhhhh!! Why cant i add a node to a treeview in formA from formB??

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    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??
    Last edited by qpabani; Apr 11th, 2001 at 09:10 PM.

  2. #2
    Dreamlax
    Guest
    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.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    it says syntax error, and highlights the first 2

  4. #4
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    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

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    nope still no luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width