Treeview Tag loosing value

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

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
 
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
 
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(datReader.Fields("Description").Value)

And then modifying the tag using the maximum node

' .Nodes(j).Tag = datReader.Fields("Ref").Value

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
 
ps: as you said it was being overwritten!

Ben said:
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(datReader.Fields("Description").Value)

And then modifying the tag using the maximum node

' .Nodes(j).Tag = datReader.Fields("Ref").Value

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
 
Ben said:
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").
 
Back
Top