CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2000
    Posts
    77

    CheckBox in Treeview

    How do i set checked property of a TreeView Node to true.

    The following is not working...

    Dim tvNode as Node

    Set tvNode = fMainForm.tvTreeView.Nodes.Add(,,, "Text",1)

    tvNode.Checked = True


    any ideas?

    Thanks.




  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: CheckBox in Treeview

    This works for me. I have used two methods for setting checkboxes. Note the tv.Checkboxes = True must come before the attempt to set a checkmark or it will fail.

    private Sub Form_Load()
    Dim nx as Node
    tv.Checkboxes = true
    set nx = tv.Nodes.Add(, , "Root", "Root")
    nx.Checked = true '--> Method Number one
    tv.Nodes.Add "Root", tvwChild, "A1", "A1"
    tv.Nodes.Add "Root", tvwChild, "A2", "A2"
    tv.Nodes("A2").Checked = true ' Method NUmber Two
    tv.Nodes("Root").Expanded = true
    End Sub




    Please rate it if it answers the question
    or is useful.
    '
    John G

  3. #3
    Join Date
    Sep 2000
    Posts
    77

    Re: CheckBox in Treeview


    Thanks for the reply.

    It works fine if any Imagelist is not linked with treeview. If i try to load any image to the node along with the checkbox, it fails...

    I want to load both Checkbox and the image.

    any idea?

    Thanks.



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

Featured