TreeView: Adding New Node In Alphabetic Sequence?

P

PeteCresswell

Got a populated TreeView.

The tree is sorted alphabetically by Node.Text

Am adding a new root-level node.

Want the new node to appear at least approximately in alphabetic
sequence in the tree.

Doesn't have tb precise - although that would be a nice-to-have - but
putting new node "Golf" at the beginning or end of the nodes that
begin with "G" would suffice.

Do I have to iterate through all the nodes beginning with the first,
looking for a relationship to my new node's .Text?

Or is there some easier way to find the first node between values "X"
and "Y"?
 
D

Douglas J. Steele

Which TreeView? Microsoft Common Controls 6.0? There's a Sorted property you
can set to ensure that the data's always in alphabetic order.
 
P

(PeteCresswell)

Per Douglas J. Steele:
Which TreeView? Microsoft Common Controls 6.0? There's a Sorted property you
can set to ensure that the data's always in alphabetic order.

Yes. Common Controls 6.0.

I'm setting .Sorted=Yes already, but it's not happening.

Maybe I need to play around with the sequence in which I set the
properties....

I'm thinking Node.Sorted=True followed by Node.Text="Golf" might
not work - whereas Node.Text="Golf" and then Node.Sorted=True
might work

Gotta look at the code again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top