rant - vb.net treeview control nodeclick event missing?

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

    rant - vb.net treeview control nodeclick event missing?

    I am upgrading from VB6 where I had access to a treeview NodeClick event
    (see below)... but now VB.NET does not have this any more.

    Private Sub TreeView1_NodeC lick(ByVal Node As MSComctlLib.Nod e)
    ' VB6 code here.
    End Sub

    The VB.NET way seems to be inspect the SelectedNode property within the
    TreeView's Click event... however this is extreamly buggy, and actually
    fails under some very simple circumstances, telling me that one node is
    selected, when in fact a different node is shown as selected. This is easily
    reproducible behaviour, and I'll send the code if anyone's interested.

    I find it hard to believe that Microsoft programmers STILL can't produce
    good quality code (although I should not be surprised). It's like the
    TreeView control is something they just can't fathom. We've had it for
    years!!! You'd think it should actually get better - not worse!

    I am using the Infragistics UltraTreeView control and although it does not
    have a NodeClick event either, it's SelectedNode property seems to work as
    expected. As a result, I am not going to use the Microsoft control.

    Summary:

    * Microsoft can't write TreeView controls.

    * Microsoft can't write decent help files.
    Not only does the help file contain utterly useless crap (and send you
    around in circles) it is so SLOW on my Dual Pentium Processor (2.4GHz) that
    it is quicker for me to look up information using Google, than it is to
    interrogate my own Hard Drive. Is this progress my Microsoft? You decide.

    * Did I mention the help file was useless? Oh yeah... sorry.

    - Peter






  • Cor

    #2
    Re: rant - vb.net treeview control nodeclick event missing?

    Hi Spam,
    [color=blue]
    > I find it hard to believe that Microsoft programmers STILL can't produce
    > good quality code (although I should not be surprised).[/color]
    [color=blue]
    > I am using the Infragistics UltraTreeView control and although it does not
    > have a NodeClick event either, it's SelectedNode property seems to work as
    > expected.[/color]

    You are not really able to tell if the SelectedNode property works in your
    program as expected.

    Are you sure that you have the the right to blame the Microsoft programmers?

    Just my thought.

    Cor


    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: rant - vb.net treeview control nodeclick event missing?

      * "Spam Trap" <spam@midar.com > scripsit:[color=blue]
      > Private Sub TreeView1_NodeC lick(ByVal Node As MSComctlLib.Nod e)
      > ' VB6 code here.
      > End Sub
      >
      > The VB.NET way seems to be inspect the SelectedNode property within the
      > TreeView's Click event... however this is extreamly buggy, and actually
      > fails under some very simple circumstances, telling me that one node is
      > selected, when in fact a different node is shown as selected. This is easily
      > reproducible behaviour, and I'll send the code if anyone's interested.[/color]

      Can you post some code to easily reproduce that behavior?
      [color=blue]
      > Not only does the help file contain utterly useless crap (and send you
      > around in circles) it is so SLOW on my Dual Pentium Processor (2.4GHz) that
      > it is quicker for me to look up information using Google, than it is to
      > interrogate my own Hard Drive. Is this progress my Microsoft? You decide.[/color]

      Mhm... The MSDN Library runs very fast on my PII 350 MHz.

      ;->

      --
      Herfried K. Wagner [MVP]
      <http://www.mvps.org/dotnet>

      Comment

      • Spam Trap

        #4
        Re: rant - vb.net treeview control nodeclick event missing?

        "Cor" <non@non.com> wrote in message
        news:eSFoVmC2DH A.1188@TK2MSFTN GP11.phx.gbl...[color=blue]
        > Hi Spam,
        >[color=green]
        > > I find it hard to believe that Microsoft programmers STILL can't produce
        > > good quality code (although I should not be surprised).[/color]
        >[color=green]
        > > I am using the Infragistics UltraTreeView control and although it does[/color][/color]
        not[color=blue][color=green]
        > > have a NodeClick event either, it's SelectedNode property seems to work[/color][/color]
        as[color=blue][color=green]
        > > expected.[/color]
        >
        > You are not really able to tell if the SelectedNode property works in your
        > program as expected.
        >
        > Are you sure that you have the the right to blame the Microsoft[/color]
        programmers?[color=blue]
        >
        > Just my thought.
        >
        > Cor[/color]

        That's quite a bold statement yourself! How long have you been programming
        with VB.any-version?

        - Peter



        Comment

        • Cor

          #5
          Re: rant - vb.net treeview control nodeclick event missing?

          I did not do that statement you did

          it's SelectedNode property seems to work


          Comment

          • scorpion53061

            #6
            Re: rant - vb.net treeview control nodeclick event missing?

            Mr.Spam,

            How long ago Cor became a programmer is irrelevant to this discussion.

            However if you must know Cor is an excellent programmer.

            ..AfterSelect may be something you want to look into.

            Don't come back and insult anyone else. I have had my fill of it and my
            tolerance is low.


            "Spam Trap" <spam@midar.com > wrote in message
            news:40014252$0 $26117$afc38c87 @news.optusnet. com.au...[color=blue]
            > "Cor" <non@non.com> wrote in message
            > news:eSFoVmC2DH A.1188@TK2MSFTN GP11.phx.gbl...[color=green]
            > > Hi Spam,
            > >[color=darkred]
            > > > I find it hard to believe that Microsoft programmers STILL can't[/color][/color][/color]
            produce[color=blue][color=green][color=darkred]
            > > > good quality code (although I should not be surprised).[/color]
            > >[color=darkred]
            > > > I am using the Infragistics UltraTreeView control and although it does[/color][/color]
            > not[color=green][color=darkred]
            > > > have a NodeClick event either, it's SelectedNode property seems to[/color][/color][/color]
            work[color=blue]
            > as[color=green][color=darkred]
            > > > expected.[/color]
            > >
            > > You are not really able to tell if the SelectedNode property works in[/color][/color]
            your[color=blue][color=green]
            > > program as expected.
            > >
            > > Are you sure that you have the the right to blame the Microsoft[/color]
            > programmers?[color=green]
            > >
            > > Just my thought.
            > >
            > > Cor[/color]
            >
            > That's quite a bold statement yourself! How long have you been programming
            > with VB.any-version?
            >
            > - Peter
            >
            >
            >[/color]


            Comment

            • Brian W

              #7
              Re: rant - vb.net treeview control nodeclick event missing?

              Maybe you should have spent a littl more time looking at teh help.

              The example code shown at the topic for GetNodeAt(...) should be fool-proof.

              HTH
              Brian W


              "Spam Trap" <spam@midar.com > wrote in message
              news:4000c20f$0 $25561$afc38c87 @news.optusnet. com.au...[color=blue]
              > I am upgrading from VB6 where I had access to a treeview NodeClick event
              > (see below)... but now VB.NET does not have this any more.
              >
              > Private Sub TreeView1_NodeC lick(ByVal Node As MSComctlLib.Nod e)
              > ' VB6 code here.
              > End Sub
              >
              > The VB.NET way seems to be inspect the SelectedNode property within the
              > TreeView's Click event... however this is extreamly buggy, and actually
              > fails under some very simple circumstances, telling me that one node is
              > selected, when in fact a different node is shown as selected. This is[/color]
              easily[color=blue]
              > reproducible behaviour, and I'll send the code if anyone's interested.
              >
              > I find it hard to believe that Microsoft programmers STILL can't produce
              > good quality code (although I should not be surprised). It's like the
              > TreeView control is something they just can't fathom. We've had it for
              > years!!! You'd think it should actually get better - not worse!
              >
              > I am using the Infragistics UltraTreeView control and although it does not
              > have a NodeClick event either, it's SelectedNode property seems to work as
              > expected. As a result, I am not going to use the Microsoft control.
              >
              > Summary:
              >
              > * Microsoft can't write TreeView controls.
              >
              > * Microsoft can't write decent help files.
              > Not only does the help file contain utterly useless crap (and send[/color]
              you[color=blue]
              > around in circles) it is so SLOW on my Dual Pentium Processor (2.4GHz)[/color]
              that[color=blue]
              > it is quicker for me to look up information using Google, than it is to
              > interrogate my own Hard Drive. Is this progress my Microsoft? You decide.
              >
              > * Did I mention the help file was useless? Oh yeah... sorry.
              >
              > - Peter
              >
              >
              >
              >
              >
              >[/color]


              Comment

              • Spam Trap

                #8
                Re: rant - vb.net treeview control nodeclick event missing?

                "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
                news:up6zT0D2DH A.2888@tk2msftn gp13.phx.gbl...[color=blue]
                > * "Spam Trap" <spam@midar.com > scripsit:[color=green]
                > > Private Sub TreeView1_NodeC lick(ByVal Node As MSComctlLib.Nod e)
                > > ' VB6 code here.
                > > End Sub
                > >
                > > The VB.NET way seems to be inspect the SelectedNode property within the
                > > TreeView's Click event... however this is extreamly buggy, and actually
                > > fails under some very simple circumstances, telling me that one node is
                > > selected, when in fact a different node is shown as selected. This is[/color][/color]
                easily[color=blue][color=green]
                > > reproducible behaviour, and I'll send the code if anyone's interested.[/color]
                >
                > Can you post some code to easily reproduce that behavior?
                >[color=green]
                > > Not only does the help file contain utterly useless crap (and send you
                > > around in circles) it is so SLOW on my Dual Pentium Processor (2.4GHz)[/color][/color]
                that[color=blue][color=green]
                > > it is quicker for me to look up information using Google, than it is to
                > > interrogate my own Hard Drive. Is this progress my Microsoft? You[/color][/color]
                decide.[color=blue]
                >
                > Mhm... The MSDN Library runs very fast on my PII 350 MHz.
                >
                > ;->
                >
                > --
                > Herfried K. Wagner [MVP]
                > http://www.mvps.org/dotnet[/color]

                Steps to reproduce behaviour:

                1) Create a form, place a treeview control on it.
                2) Paste this code.

                Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
                System.EventArg s) Handles MyBase.Load
                Dim nodX As TreeNode
                nodX = Me.TreeView1.No des.Add("Parent Node")
                nodX.Nodes.Add( "Child Node")
                End Sub

                Private Sub TreeView1_Click (ByVal sender As Object, ByVal e As
                System.EventArg s) Handles TreeView1.Click
                MsgBox(Me.TreeV iew1.SelectedNo de.Text)
                End Sub

                3) When you click on the parent, the correct node is displayed.
                4) Expand the parent node (by clicking on the little plus symbol).
                5) Click on the Child. Despite hilighting the child node (when the mouse
                button is down), the "parent" is returned. Only after the "TreeView1_Clic k"
                routine has completed, does the node get selected. I believe this makes the
                Click event useless when used in conjuction with the SelectedNode property.

                If you alternatly click each node, you will always get the wrong result
                returned. Only clicking the node twice (not a double-click), will return the
                expected result.

                Now... is this just my computer doing this, or does anyone owe me an
                apology?

                - Peter


                Comment

                • Spam Trap

                  #9
                  Re: rant - vb.net treeview control nodeclick event missing?

                  "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
                  news:up6zT0D2DH A.2888@tk2msftn gp13.phx.gbl...[color=blue]
                  > * "Spam Trap" <spam@midar.com > scripsit:[color=green]
                  > > Private Sub TreeView1_NodeC lick(ByVal Node As MSComctlLib.Nod e)
                  > > ' VB6 code here.
                  > > End Sub
                  > >
                  > > The VB.NET way seems to be inspect the SelectedNode property within the
                  > > TreeView's Click event... however this is extreamly buggy, and actually
                  > > fails under some very simple circumstances, telling me that one node is
                  > > selected, when in fact a different node is shown as selected. This is[/color][/color]
                  easily[color=blue][color=green]
                  > > reproducible behaviour, and I'll send the code if anyone's interested.[/color]
                  >
                  > Can you post some code to easily reproduce that behavior?
                  >[color=green]
                  > > Not only does the help file contain utterly useless crap (and send you
                  > > around in circles) it is so SLOW on my Dual Pentium Processor (2.4GHz)[/color][/color]
                  that[color=blue][color=green]
                  > > it is quicker for me to look up information using Google, than it is to
                  > > interrogate my own Hard Drive. Is this progress my Microsoft? You[/color][/color]
                  decide.[color=blue]
                  >
                  > Mhm... The MSDN Library runs very fast on my PII 350 MHz.
                  >
                  > ;->
                  >
                  > --
                  > Herfried K. Wagner [MVP]
                  > http://www.mvps.org/dotnet[/color]

                  Steps to reproduce behaviour:

                  1) Create a form, place a treeview control on it.
                  2) Paste this code.

                  Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
                  System.EventArg s) Handles MyBase.Load
                  Dim nodX As TreeNode
                  nodX = Me.TreeView1.No des.Add("Parent Node")
                  nodX.Nodes.Add( "Child Node")
                  End Sub

                  Private Sub TreeView1_Click (ByVal sender As Object, ByVal e As
                  System.EventArg s) Handles TreeView1.Click
                  MsgBox(Me.TreeV iew1.SelectedNo de.Text)
                  End Sub

                  3) When you click on the parent, the correct node is displayed.
                  4) Expand the parent node (by clicking on the little plus symbol).
                  5) Click on the Child. Despite hilighting the child node (when the mouse
                  button is down), the "parent" is returned. Only after the "TreeView1_Clic k"
                  routine has completed, does the node get selected. I believe this makes the
                  Click event useless when used in conjuction with the SelectedNode property.

                  If you alternatly click each node, you will always get the wrong result
                  returned. Only clicking the node twice (not a double-click), will return the
                  expected result.

                  Now... is this just my computer doing this, or does anyone owe me an
                  apology?

                  - Peter


                  Comment

                  • scorpion53061

                    #10
                    Re: rant - vb.net treeview control nodeclick event missing?

                    Peter,

                    Thanks for playing.

                    Go Away.


                    Comment

                    • scorpion53061

                      #11
                      Re: rant - vb.net treeview control nodeclick event missing?

                      Peter,

                      Thanks for playing.

                      Go Away.


                      Comment

                      • Spam Trap

                        #12
                        Re: rant - vb.net treeview control nodeclick event missing?

                        So you

                        "scorpion53 061" <Its the end of the world as we know it@here.com> wrote in
                        message news:OvPlbtP2DH A.2032@TK2MSFTN GP09.phx.gbl...[color=blue]
                        > Peter,
                        >
                        > Thanks for playing.
                        >
                        > Go Away.
                        >
                        >[/color]


                        Comment

                        • Spam Trap

                          #13
                          Re: rant - vb.net treeview control nodeclick event missing?

                          So you

                          "scorpion53 061" <Its the end of the world as we know it@here.com> wrote in
                          message news:OvPlbtP2DH A.2032@TK2MSFTN GP09.phx.gbl...[color=blue]
                          > Peter,
                          >
                          > Thanks for playing.
                          >
                          > Go Away.
                          >
                          >[/color]


                          Comment

                          • Spam Trap

                            #14
                            Re: rant - vb.net treeview control nodeclick event missing?


                            "scorpion53 061" <Its the end of the world as we know it@here.com> wrote in
                            message news:OvPlbtP2DH A.2032@TK2MSFTN GP09.phx.gbl...[color=blue]
                            > Peter,
                            >
                            > Thanks for playing.
                            >
                            > Go Away.
                            >
                            >[/color]

                            So you think the code I posted does not contain confusing behaviour or bugs?

                            It's convient that you want me to go away, the very instant I provide you
                            proof. That must make you feel uncomfortable since you were so willing to
                            leap to the defence of someone that insulted my ability to find a bug with
                            Microsoft's treeview control (specifically with the Click event and the
                            SelectedNode property). If it isn't an outright bug, then at the least it's
                            confusing behaviour that 3rd party vendors have not been keen to emulate.
                            IMHO, it's a bug.

                            - Peter


                            Comment

                            • Spam Trap

                              #15
                              Re: rant - vb.net treeview control nodeclick event missing?


                              "scorpion53 061" <Its the end of the world as we know it@here.com> wrote in
                              message news:OvPlbtP2DH A.2032@TK2MSFTN GP09.phx.gbl...[color=blue]
                              > Peter,
                              >
                              > Thanks for playing.
                              >
                              > Go Away.
                              >
                              >[/color]

                              So you think the code I posted does not contain confusing behaviour or bugs?

                              It's convient that you want me to go away, the very instant I provide you
                              proof. That must make you feel uncomfortable since you were so willing to
                              leap to the defence of someone that insulted my ability to find a bug with
                              Microsoft's treeview control (specifically with the Click event and the
                              SelectedNode property). If it isn't an outright bug, then at the least it's
                              confusing behaviour that 3rd party vendors have not been keen to emulate.
                              IMHO, it's a bug.

                              - Peter


                              Comment

                              Working...