TreeView Sorting

TreeView Sorting

Anonymous
Not applicable
217 Views
4 Replies
Message 1 of 5

TreeView Sorting

Anonymous
Not applicable
I've created a TreeView control on a form. I've got the code to populate it
in the form's Initialize event. After the control is populated I set it's
Sorted property to True...it doesn't sort 😞 What overly documented
crucial piece of info am I missing?

TIA

VBA in A2ki on Win2k
--
Happy Holidays...
Bobby C. Jones
http://www.acadx.com
0 Likes
218 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Hi Bobby:
I use a treeview that gets values from ADO database objects. I use the SORT
method before i populate the treeview...

Dim rstRecords As New ADODB.Recordset
rstRecords .CursorLocation = adUseClient
rstRecords .Open "qryAccessQuery", cnn, adLockReadOnly
rstRecords .Sort = Name

This sorts the treeview on a column called 'Name'. It may not be perfect
but it works for me. good luck.
Sean


"Bobby C. Jones" wrote in message
news:E393F51CB41B2A9002791D3A8A61DFCD@in.WebX.maYIadrTaRb...
> I've created a TreeView control on a form. I've got the code to populate
it
> in the form's Initialize event. After the control is populated I set it's
> Sorted property to True...it doesn't sort 😞 What overly documented
> crucial piece of info am I missing?
>
> TIA
>
> VBA in A2ki on Win2k
> --
> Happy Holidays...
> Bobby C. Jones
> http://www.acadx.com
>
>
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
Thanks Sean, Unfortunately my data is not stored in a database...I have sort
functions and I can pre-sort my data before populating the control, but it
appeared that I could have the control sort for me...
--
Happy Holidays...
Bobby C. Jones
http://www.acadx.com
0 Likes
Message 4 of 5

Anonymous
Not applicable
Bobby

If you are adding nodes with something like

Set nodEntry = TreeView1.Nodes.Add(sColor, tvwChild, sCompLoc, sComponent, "Thaw")

then you can simply add after it
nodEntry.Sorted = True

Works for me

--
Kent Keller
http://kwikmcad.topcities.com/

"Bobby C. Jones" wrote in message
news:9E59BB8A82EB372394AA5E1C996000E5@in.WebX.maYIadrTaRb...
> Thanks Sean, Unfortunately my data is not stored in a database...I have sort
> functions and I can pre-sort my data before populating the control, but it
> appeared that I could have the control sort for me...
> --
> Happy Holidays...
> Bobby C. Jones
> http://www.acadx.com
>
>
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
That's the winner! Thanks Kent.
--
Happy Holidays...
Bobby C. Jones
http://www.acadx.com
0 Likes