Treeview Tag loosing value

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

    Treeview Tag loosing value

    Hi

    We are having random problems with the treeview control.

    We are loading the data from a database and using the Tag property to hold
    the database record reference. Occasionally on a child node the value in
    the tag property is missing.

    I have used a message box to check that the value in the tag property is
    there immediately after loading the data into it. It is there, but after
    another routine it is missing.

    Initially I believed it to be that the tag was being edited elsewhere, but
    it is not. I also have vertifed no coding errors. It is starting to drive
    me mad.

    Any advice would be much appricated

    Thanks
    B

    PS: Visual Studio 2003 Pro, .Net Framework 1.1


  • Cor Ligthert [MVP]

    #2
    Re: Treeview Tag loosing value

    Ben,

    There are no miracles, probably it is overwritten somewhere, but that will
    probably a hard job to look for. I can ask you to show us some code, but
    that you have already checked thousand times. This is the hard part of our
    job.

    It would be nice if there was something in VB.Net that would throw an event
    when a value in whatever was changing. As far as I know that does not exist.
    (Is it is I see it than here and we both are happy)

    Cor

    "Ben" <Ben@Newsgroups .microsoft.coms chreef in bericht
    news:uMy4q9wXHH A.2268@TK2MSFTN GP06.phx.gbl...
    Hi
    >
    We are having random problems with the treeview control.
    >
    We are loading the data from a database and using the Tag property to hold
    the database record reference. Occasionally on a child node the value in
    the tag property is missing.
    >
    I have used a message box to check that the value in the tag property is
    there immediately after loading the data into it. It is there, but after
    another routine it is missing.
    >
    Initially I believed it to be that the tag was being edited elsewhere, but
    it is not. I also have vertifed no coding errors. It is starting to
    drive me mad.
    >
    Any advice would be much appricated
    >
    Thanks
    B
    >
    PS: Visual Studio 2003 Pro, .Net Framework 1.1
    >

    Comment

    • Ben

      #3
      Re: Treeview Tag loosing value

      Hi Cor

      Thanks for your post....

      I am now kicking myself... it was the sorting!!!!

      I was adding an item using the code:

      ' .Nodes.Add(datR eader.Fields("D escription").Va lue)

      And then modifying the tag using the maximum node

      ' .Nodes(j).Tag = datReader.Field s("Ref").Valu e

      But because it was sorting them it was placing them out of order.

      Ahh well, that will teach me for only looking at the code, not the
      properties, sorting switched off SQL providing sorting now.

      Thanks again,

      B

      "Cor Ligthert [MVP]" <notmyfirstname @planet.nlwrote in message
      news:ef$YmwxXHH A.4520@TK2MSFTN GP06.phx.gbl...
      Ben,
      >
      There are no miracles, probably it is overwritten somewhere, but that will
      probably a hard job to look for. I can ask you to show us some code, but
      that you have already checked thousand times. This is the hard part of our
      job.
      >
      It would be nice if there was something in VB.Net that would throw an
      event when a value in whatever was changing. As far as I know that does
      not exist. (Is it is I see it than here and we both are happy)
      >
      Cor
      >
      "Ben" <Ben@Newsgroups .microsoft.coms chreef in bericht
      news:uMy4q9wXHH A.2268@TK2MSFTN GP06.phx.gbl...
      >Hi
      >>
      >We are having random problems with the treeview control.
      >>
      >We are loading the data from a database and using the Tag property to
      >hold the database record reference. Occasionally on a child node the
      >value in the tag property is missing.
      >>
      >I have used a message box to check that the value in the tag property is
      >there immediately after loading the data into it. It is there, but after
      >another routine it is missing.
      >>
      >Initially I believed it to be that the tag was being edited elsewhere,
      >but it is not. I also have vertifed no coding errors. It is starting to
      >drive me mad.
      >>
      >Any advice would be much appricated
      >>
      >Thanks
      >B
      >>
      >PS: Visual Studio 2003 Pro, .Net Framework 1.1
      >>
      >
      >

      Comment

      • Ben

        #4
        Re: Treeview Tag loosing value

        ps: as you said it was being overwritten!

        "Ben" <Ben@Newsgroups .microsoft.comw rote in message
        news:OGMPMKyXHH A.4264@TK2MSFTN GP05.phx.gbl...
        Hi Cor
        >
        Thanks for your post....
        >
        I am now kicking myself... it was the sorting!!!!
        >
        I was adding an item using the code:
        >
        ' .Nodes.Add(datR eader.Fields("D escription").Va lue)
        >
        And then modifying the tag using the maximum node
        >
        ' .Nodes(j).Tag = datReader.Field s("Ref").Valu e
        >
        But because it was sorting them it was placing them out of order.
        >
        Ahh well, that will teach me for only looking at the code, not the
        properties, sorting switched off SQL providing sorting now.
        >
        Thanks again,
        >
        B
        >
        "Cor Ligthert [MVP]" <notmyfirstname @planet.nlwrote in message
        news:ef$YmwxXHH A.4520@TK2MSFTN GP06.phx.gbl...
        >Ben,
        >>
        >There are no miracles, probably it is overwritten somewhere, but that
        >will probably a hard job to look for. I can ask you to show us some code,
        >but that you have already checked thousand times. This is the hard part
        >of our job.
        >>
        >It would be nice if there was something in VB.Net that would throw an
        >event when a value in whatever was changing. As far as I know that does
        >not exist. (Is it is I see it than here and we both are happy)
        >>
        >Cor
        >>
        >"Ben" <Ben@Newsgroups .microsoft.coms chreef in bericht
        >news:uMy4q9wXH HA.2268@TK2MSFT NGP06.phx.gbl.. .
        >>Hi
        >>>
        >>We are having random problems with the treeview control.
        >>>
        >>We are loading the data from a database and using the Tag property to
        >>hold the database record reference. Occasionally on a child node the
        >>value in the tag property is missing.
        >>>
        >>I have used a message box to check that the value in the tag property is
        >>there immediately after loading the data into it. It is there, but
        >>after another routine it is missing.
        >>>
        >>Initially I believed it to be that the tag was being edited elsewhere,
        >>but it is not. I also have vertifed no coding errors. It is starting
        >>to drive me mad.
        >>>
        >>Any advice would be much appricated
        >>>
        >>Thanks
        >>B
        >>>
        >>PS: Visual Studio 2003 Pro, .Net Framework 1.1
        >>>
        >>
        >>
        >
        >

        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: Treeview Tag loosing value

          "Ben" <Ben@Newsgroups .microsoft.coms chrieb:
          We are having random problems with the treeview control.
          >
          We are loading the data from a database and using the Tag property to hold
          the database record reference. Occasionally on a child node the value in
          the tag property is missing.
          >
          I have used a message box to check that the value in the tag property is
          there immediately after loading the data into it. It is there, but after
          another routine it is missing.
          >
          Initially I believed it to be that the tag was being edited elsewhere, but
          it is not. I also have vertifed no coding errors. It is starting to
          drive me mad.
          The 'Tag' property is a simple property of type 'Object' that stores its
          value in a private variable. I think you have to look at your code again
          (yes, and unfortunately VB 2005 still does not support a "break when
          variable/property value changes").

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

          Comment

          Working...