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 5993291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:39:15+00:00 2026-05-22T23:39:15+00:00

I have a Nhibernate Database which provide the Data as hierarchical List<>. I have

  • 0

I have a Nhibernate Database which provide the Data as hierarchical List<>. I have a TreeView in my Windows Forms GUI and a Backgroundworker which populate the TreeView with all Root Nodes and their Children (nothing more because of Lazy loading exception from NHibernate but this is okay because I expect that the user will have many Nodes in the TreeView).

The process to add the Root nodes and their children to the TreeView works pretty well but when I click on a Node to expand it all children of the children should be loaded from the Database and added to the TreeView. The Nodes are requested successfully from the Database and are stored in the buffer list (when Click on the node to expand it).

After that I tried a few ideas like rebuild the TreeView and repopulate it completely but with this solution I got the Problem that all expanded Nodes are collapsed so I tried to store the node that is expanded and it worked. But I am not quite happy with this solution, I got the feeling it can be done easier, because I don’t want to repopulate the TreeView every time the User is expanding a Node.

How can I reload the Children of a TreeNode from the Database and display it in the TreeView without repopulating the whole TreeView?

  • 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-05-22T23:39:16+00:00Added an answer on May 22, 2026 at 11:39 pm

    This SO Question should provide some help on the lazy loading.

    It uses a threadpool instead of a background worker which you can find arguments for/against on google, but in my opinion its not a bad choice to use the threadpool in Winforms.

    With the above post to guide you, pass the node that is being expanded through to worker. Once you have the data required to populate the node, use the standard If ##.InvokeRequired Pattern to do the actual work on the node.

    Hope that helps.

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

Sidebar

Related Questions

I have a bean which I map to the database using Hibernate. I'm using
I use NHibernate and have a custom type for encrypting passwords in the database
My database is being driven by my NHibernate mapping files. I have a Category
I am using NHibernate's SchemaExport to create my database schema. I have 1 legacy
For our test fixtures we use NHibernate to generate a database schema. We have
I have some EJBs that use Hibernate to persist data to the database. I
I have a C# WinForms application with a database backend (oracle) and use NHibernate
I am trying to get Informix working with NHibernate on windows 7. I have
NHibernate seems to have some new ways to map entities in code, which is
I am connecting a MYSQL database through hibernate and i seem to have processes

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.