Results 1 to 7 of 7

Thread: TreeView Hangs

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    13

    Question TreeView Hangs

    I'm using the TreeView control to display a list of airports worldwide. The fields include:

    Country, State/Prov, City, Airport

    The source is a simple text file. The total number of Airports locations is 23,821. The Tree loads up and displays all the airports correctly. The problem occurs when you end the program. If you close it while in VB6 it freezes VB6 for close to two minutes. (You can run other apps during this time, only VB6 is frozen). If you compile the program and run it outside of VB the same problem occurs. When you end the program it clears the screen immedialtey but if you pull up the task list the program still shows as loaded and running. After a short delay the program then shows as still loaded but "not responding". It does eventually close. (On closing I "unload" the form and then "End" the program).

    If I limit the number of Airports displayed the "Hang" time is reduced accordingly. Could this be related to some kind of memory problem? Does the TreeView have a maximum number of branches? Never had this problem before. Any ideas?

    Thanks,

    Dave W

  2. #2

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    13

    Resolved Re: TreeView Hangs

    I tried inloading the nodes but that didn't solve the problem. Here's the code used to close the program.

    VB Code:
    1. Private Sub cmdQuit_Click()
    2.  
    3.     ' Clear the nodes
    4.     TreeView1.Nodes.Clear
    5.     ' Unload the Form
    6.     Unload frmListView
    7.     ' Close and End
    8.     Close: End
    9.  
    10. End Sub

    I've attached a zip file containing the project. Maybe you can spot something there. (excuse the coding, I'm self taught)

    Thanks,

    Dave W
    Attached Files Attached Files

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: TreeView Hangs

    There's nothing wrong with the code you show. I'm a little concerned about the Close: label and I hope you are not doing a GoTo Closesomeplace in the Sub. If you aren't then it doesn't hurt anything but you don't need the label.

    I think I remember someone else having a problem closing a form that had a large treeview. It will probably be hard to find but you might use the Advanced Search and look for something like treeview close and see what you can find.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    13

    Resolved Re: TreeView Hangs

    Hi Marty,

    The "Close: End" is not a Close label, I just put the two statements on the same line separated with a colen. i.e.

    Close
    End

    I'll do another search and see if I can find an answer. This one sure has me baffled! Thanks for your help.

    Dave W

  6. #6

  7. #7
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657

    Re: TreeView Hangs

    I'm not sure what's causing your issue, but one thing to consider is dynamically populating the childen nodes when the parent node is expanded - i.e., load only the countries first - then when a country is expanded, load the corresponding states - when the state is expanded, load the cities - and so on. (you could even remove the children nodes when the parent is collapsed)

    This of course requires a bit more coding on your part, but it will keep the node count to a minimum ...
    "It's cold gin time again ..."

    Check out my website here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width