TreeView control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #16
    Originally posted by cogaihalan
    Thank you, i probably didn't make myself clear enough. It is a lil bit confusing for me.

    I have successfully constructed the tree, but the information that is useful for the end user if they can extract the information out of the tree and use it.

    Using the treview that we have here as an example, if I want to select service quality (which is under OPS and SOAR), is there a way to extract the levels i have go through in a text string that can look something like this:

    OPS/ SOAR/ Service Quality

    On the same line, if I want to convert to text string just SOAR ( under OPS), it will give me OPS/SOAR ?

    and hopefully the same thing will happen if i click something else in the treeview.

    I dont know if this can be accomplished by using buttons and text boxes or using something else.

    Please help. I really Appreciate it. you are the man
    You could extract all Children of Main Node and concatenate the result as in: Main Node/Child 1/Child 2/Child 3/...etc.
    Is this what you are looking for? If it is you can Reference the Help Files for the Child and Parent properties. If you still have difficulties, let me know.

    Comment

    • cogaihalan
      New Member
      • Oct 2008
      • 8

      #17
      I hope you can see the tree that i just made.




      One that tree, i created a submit button (it can't do anything yet), but i would love if it can extract from my selection.

      In this ex, i select professional by going through legal- professional, when i click submit button, it should return the string "legal/ professional" like in the example





      similarly, for automobile, if i click automobile and then submit, it will return the string " automobile" in the box.



      Is there any ways to accomplish this?

      Thanks

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #18
        Originally posted by cogaihalan
        I hope you can see the tree that i just made.




        One that tree, i created a submit button (it can't do anything yet), but i would love if it can extract from my selection.

        In this ex, i select professional by going through legal- professional, when i click submit button, it should return the string "legal/ professional" like in the example





        similarly, for automobile, if i click automobile and then submit, it will return the string " automobile" in the box.



        Is there any ways to accomplish this?

        Thanks
        It'as probably a lit simpler than you realize, the the NodeClick() Event of the treeView Control, place the following code for a visual cue:
        Code:
        Private Sub TReeview1_NodeClick(ByVal Node As Object)
          MsgBox Replace(Node.FullPath, "\", "/")
        End Sub

        Comment

        • cogaihalan
          New Member
          • Oct 2008
          • 8

          #19
          Originally posted by ADezii
          It'as probably a lit simpler than you realize, the the NodeClick() Event of the treeView Control, place the following code for a visual cue:
          Code:
          Private Sub TReeview1_NodeClick(ByVal Node As Object)
            MsgBox Replace(Node.FullPath, "\", "/")
          End Sub
          Wow thats only a 3 line of codes. lol Thanks man, but i have a compiler error saying that " procedure declaration does not match description of event or procedure having the same name".. that sucks.

          So I went ahead trying to find solutions for this compiler error, but nothing is really showing up.

          Crap, so I created a label so i can show this, using the following code

          Label1.Caption = nodX.FullPath

          (nodX is the variable)

          Well, it shows, but it only shows the last one, and it did not show anything else when i click through nodes. Is there any updates can be done, or even an If function might be helpful.

          Thanks

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #20
            Originally posted by cogaihalan
            Wow thats only a 3 line of codes. lol Thanks man, but i have a compiler error saying that " procedure declaration does not match description of event or procedure having the same name".. that sucks.

            So I went ahead trying to find solutions for this compiler error, but nothing is really showing up.

            Crap, so I created a label so i can show this, using the following code

            Label1.Caption = nodX.FullPath

            (nodX is the variable)

            Well, it shows, but it only shows the last one, and it did not show anything else when i click through nodes. Is there any updates can be done, or even an If function might be helpful.

            Thanks
            The correct syntax in the NodeClick() Event is:
            Code:
            Me![Label1].Caption = Node.FullPath

            Comment

            • cogaihalan
              New Member
              • Oct 2008
              • 8

              #21
              Originally posted by ADezii
              The correct syntax in the NodeClick() Event is:
              Code:
              Me![Label1].Caption = Node.FullPath
              So should i use the IF loop for this? I tries to implement the code in various lines, but the label only shows the node that is above this code.

              Is there anyways to show the appropriate path when choosing any specific node?

              Thanks

              Comment

              • ADezii
                Recognized Expert Expert
                • Apr 2006
                • 8834

                #22
                Originally posted by cogaihalan
                So should i use the IF loop for this? I tries to implement the code in various lines, but the label only shows the node that is above this code.

                Is there anyways to show the appropriate path when choosing any specific node?

                Thanks
                Yes, by using either an If...ElseIf...E lse...End If, or Select Case Structure. It all depends on which Nodes you want to exclude.

                Comment

                • cogaihalan
                  New Member
                  • Oct 2008
                  • 8

                  #23
                  Originally posted by ADezii
                  Yes, by using either an If...ElseIf...E lse...End If, or Select Case Structure. It all depends on which Nodes you want to exclude.
                  ADezii,

                  I want to inlcude every node. But only when i select them, it will show the full path. Please advice on how to use if properly for this treeview.

                  Thanks

                  Comment

                  • ADezii
                    Recognized Expert Expert
                    • Apr 2006
                    • 8834

                    #24
                    Originally posted by cogaihalan
                    ADezii,

                    I want to inlcude every node. But only when i select them, it will show the full path. Please advice on how to use if properly for this treeview.

                    Thanks
                    The code as it is now, placed in the NodeClick() Event will activate 'only' when the Node is Clicked/Selected. I don't know what else to tell you.

                    Comment

                    • cogaihalan
                      New Member
                      • Oct 2008
                      • 8

                      #25
                      Originally posted by ADezii
                      The code as it is now, placed in the NodeClick() Event will activate 'only' when the Node is Clicked/Selected. I don't know what else to tell you.
                      Thanks, ADezii,

                      I found the solution for this. This following code works:

                      Private Sub Tree_NodeClick( ByVal Node As MSComctlLib.Nod e)

                      Me.Label1.Capti on = Node.FullPath
                      End Sub

                      I have no Idea why we have to use the MSComctLib.Node , but it shows the path perfectly.

                      Thanks so much for helping me with this VBA. I really appreciate it.

                      Comment

                      • cogaihalan
                        New Member
                        • Oct 2008
                        • 8

                        #26
                        Originally posted by cogaihalan
                        Thanks, ADezii,

                        I found the solution for this. This following code works:

                        Private Sub Tree_NodeClick( ByVal Node As MSComctlLib.Nod e)

                        Me.Label1.Capti on = Node.FullPath
                        End Sub

                        I have no Idea why we have to use the MSComctLib.Node , but it shows the path perfectly.

                        Thanks so much for helping me with this VBA. I really appreciate it.
                        ADezii,

                        Its maybe really easy, but I just can't seem to find a way to record that path I show into the textbox and then add another fullpath into the same textbox. Any advice?

                        Comment

                        • ADezii
                          Recognized Expert Expert
                          • Apr 2006
                          • 8834

                          #27
                          Originally posted by cogaihalan
                          ADezii,

                          Its maybe really easy, but I just can't seem to find a way to record that path I show into the textbox and then add another fullpath into the same textbox. Any advice?
                          I'm assuming that you mean to add another Full Path to the Label Control which already contains a Full Path, if so:
                          Code:
                          Me.Label1.Caption = Me.Label1.Caption  & "\" & Node.FullPath

                          Comment

                          Working...