Treeview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • amruta

    Treeview

    How can I compare 2 treenode elements.

    can i do something like this
    if a.tag is b.tag then

    end if

    let me know

    thank you.


  • Herfried K. Wagner [MVP]

    #2
    Re: Treeview

    "amruta" <amruta@discuss ions.microsoft. com> schrieb:[color=blue]
    > How can I compare 2 treenode elements.[/color]

    When do you consider two treenode objects to be equal?

    If you want to check if two variables reference the same 'TreeNode'
    instance, you can use 'If t1 Is t2 Then...'.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: Treeview

      Herfried,
      [color=blue]
      >
      > When do you consider two treenode objects to be equal?
      >
      > If you want to check if two variables reference the same 'TreeNode'
      > instance, you can use 'If t1 Is t2 Then...'.
      >[/color]
      Is this not "Is the same type of object?

      Cor


      Comment

      • Cor Ligthert [MVP]

        #4
        Re: Treeview

        Amruta,

        Assuming that you set forever the same type of value in a tag than you can
        cast it in whatever way.
        Assume this
        a.Tag = "Amruta"
        b.Tag = "Amruta"

        Than
        a.Tag.ToString = b.Tag.ToString
        will go

        or if it was an integer value
        Cint(a.Tag) etc.

        I hope this helps,

        Cor


        "amruta" <amruta@discuss ions.microsoft. com> schreef in bericht
        news:2E731EA1-C209-40C7-B6CC-68C363B50CC2@mi crosoft.com...[color=blue]
        > How can I compare 2 treenode elements.
        >
        > can i do something like this
        > if a.tag is b.tag then
        >
        > end if
        >
        > let me know
        >
        > thank you.
        >
        >[/color]


        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: Treeview

          "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> schrieb:[color=blue][color=green]
          >> When do you consider two treenode objects to be equal?
          >>
          >> If you want to check if two variables reference the same 'TreeNode'
          >> instance, you can use 'If t1 Is t2 Then...'.
          >>[/color]
          > Is this not "Is the same type of object?[/color]

          No.

          --
          M S Herfried K. Wagner
          M V P <URL:http://dotnet.mvps.org/>
          V B <URL:http://classicvb.org/petition/>

          Comment

          • Cor Ligthert [MVP]

            #6
            Re: Treeview

            >>> If you want to check if two variables reference the same 'TreeNode'[color=blue][color=green][color=darkred]
            >>> instance, you can use 'If t1 Is t2 Then...'.
            >>>[/color]
            >> Is this not "Is the same type of object?[/color]
            >
            > No.
            >[/color]
            You mean that two variable can reference to the same ojbect which are(is)
            not from the same type of object?

            :-)

            I misreaded it and wrote it even wrong.

            :-)

            Cor


            Comment

            • Herfried K. Wagner [MVP]

              #7
              Re: Treeview

              "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> schrieb:[color=blue][color=green][color=darkred]
              >>>> If you want to check if two variables reference the same 'TreeNode'
              >>>> instance, you can use 'If t1 Is t2 Then...'.
              >>>>
              >>> Is this not "Is the same type of object?[/color]
              >>
              >> No.
              >>[/color]
              > You mean that two variable can reference to the same ojbect which are(is)
              > not from the same type of object?[/color]

              Well, as you know for sure, object identity implies that there's only a
              single object ;-).

              --
              M S Herfried K. Wagner
              M V P <URL:http://dotnet.mvps.org/>
              V B <URL:http://classicvb.org/petition/>

              Comment

              Working...