Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8310473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:28:22+00:00 2026-06-08T19:28:22+00:00

I have a Treeview control with each item having a checkbox. At root level

  • 0

I have a Treeview control with each item having a checkbox. At root level i have around 100 items and each such item has 100 further items, so traversing the tree takes time of about 1-2 seconds. I want to reduce that time. So here is my question, How to get number of checked items in the treeview control without traversing through the treeview control?

I checked msdn. There we have “Treeview_GetCount” but it gives total number of items in treeview control. I know i can start from root and traverse down recursively to check state of each item in tree view and finally get the number of items with checked state.

Alternative we may have a variable (class member or global) and increment it when item is checked and decrement it when item is unchecked, that will finally give me number of items in one instance.

Is there any other better way then these?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:28:24+00:00Added an answer on June 8, 2026 at 7:28 pm

    Unfortunately, you have to traverse the tree view calling TreeView_GetCheckState to get such information. Alternatively, you can associate check state through the lParam of TVITEM when inserting items but this still requires traversal.

    What is the problem with traversing the control? If it is too slow for some reason, you can always store the number in a variable which you update.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi The problem am having is that I have multiple TreeView control and each
I have a TreeView control with a bunch of TreeNodes. Each nodes ContextMenu has
I have treeview control with one level of parent and child nodes, each node
Background: I have a custom user control based around a WPF TreeView. I've been
I have a treeview that is bound to a database table. Each treeview item
I have a TreeView control which displays two things: 1) Folder 2) Item Where
I have a TreeView control in my WinForms .NET application that has multiple levels
I have a TreeView control on a form. I am dynamically adding new TreeNodes
I have a treeview control that functions like a folder browser. Because loading the
I have a winforms TreeView control that allows you to browse an object hierarchy.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.