RowTag Q

I have a question about RowTag usage in a listbox. I need to keep track of my DB primary key and my indent levels (hierarchy) and I was planning to do that with a row tag. Is there a better way to track these two items in my hierarchial list box? How would this best be structured, comma separated values in my row tag?

Thank you,

custom class to hold all the bits of data

Hint on how to do this?

cerate a new class
add properties as needed to it
then when you add rows create a new instance of the class & set the properties & set that in the rowtag for the row

I really cant tell you “how to” because I have no idea what data you want to put in there nor how you want to use it

You certainly could use a comma separated value stored in the rowtag then parse that as needed.

I know that RowTag is the best practice and recommended way to do this. Prior to the introduction of rowtag most just created additional columns in the list box and gave them a width of 0%, effectively hiding them but allowing them to be referenced in code just as you would reference any other column. this also allows the ability to have multiple hidden columns (Primary Key, Indent) which I see as a benefit. I believe RowTag is one dimensional.

Why is this not an acceptable method of accomplishing something like this?

I use CellTag for additional data.


lst.RowTag(i) = PK lst.CellTag(i,0) = IndentLevel lst.CellTag(i,1) = OtherData

You can use the columns beyond ColumnCount. No need for zero-width columns and they are totally inaccessible to the user. A zero-width column can be expanded in certain circumstances.

That said, a custom class in RowTag is the best approach.

I usually use a dictionary for this type of data.

That said your presentation layer should manage the internals like the indentation. And the data layer should manage the keys.

I use the rowtag to store the PK