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

  • Home
  • SEARCH
  • 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 4076082
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:22:48+00:00 2026-05-20T17:22:48+00:00

I am developing a parser application to build a call tree from DDL files

  • 0

I am developing a parser application to build a call tree from DDL files that have been extracted from a database. The idea is to take a large number of these DDL files and determine exactly what calls what. To do this I am using a .NET TreeView. The final output I am working toward is something like this:

-Proc1
  -Proc2
    -Proc3
  -Proc4
-Proc2
  -Proc3
-Proc3
-Proc4

Now, all of my parsing is working correctly. Though, this process is quite lengthy. As such I have decided to move all of the heavyweight processing onto its own thread. Everything is working as intended until I get to the point where I need to update my TreeView. I am attempting to keep all of the actual update logic on the separate thread and only update the TreeView. However, despite having my main form SyncLocked, I am still getting an exception when I try to access the tree.

I have found quite a few examples online that show how to use Delegates for thread-safe access but, unfortunately, they are all a bit simplistic for my needs. Most simply show how to set a text property. As I mentioned before, I am trying to keep as much of the processing as possible on the worker thread and only call the respective TreeView methods to update as this process can be quite long winded (hundreds of procedures to parse and display at a time).

Is there a good way to do this or should I just take my lumps and pass my entire dependency tree back to my main form?

Here is the code I am currently using to display the first level of dependencies. Remember, this will eventually be recursive (currently in “get it working” mode) which is why I want to keep it off the UI thread:

Public Sub updateTreeView()

    Dim arrNodeList As ArrayList
    Dim childNode As clsProcedureNode
    Dim currentNode As clsProcedureNode
    Dim intChildIndex As Integer
    Dim intNodeListIndex As Integer
    Dim treeView As TreeView

    //Lock main form
    SyncLock mMainForm

        //Check that we are actually running on a seprate thread
        If mMainForm.InvokeRequired() = True Then

            //Call delegate to get handle to TreeView
            treeView = mMainForm.Invoke(mGetTreeViewDelegate)

            //Add Parsed array to main form TreeView
            For intNodeListIndex = 0 To mProcedureNodes.Length - 1

                //Get current node and its child list
                currentNode = mProcedureNodes(intNodeListIndex)
                arrNodeList = currentNode.getProcsCalled()

                //Add node and all children to TreeView
                With treeView
                    .BeginUpdate()
                    .Nodes.Add(currentNode.getName())
                    For intChildIndex = 0 To arrNodeList.Count
                        childNode = arrNodeList.Item(intChildIndex)
                        .Nodes(intNodeListIndex).Nodes.Add(childNode.getName())
                    Next
                    .EndUpdate()
                End With
            Next
        End If   
    End SyncLock   
End Sub
  • 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-20T17:22:49+00:00Added an answer on May 20, 2026 at 5:22 pm

    Why don’t you use BackgroundWorker? It’s way easier to use than Invoke and synchronization. In fact, it was designed to ease things like this.

    You can do your background work in DoWork event handler which runs on other thread and safely interact with you UI in ProgressChanged event handler which runs on UI thread. The need for invoking ProgressChanged is signaled in DoWork using ReportProgress method of BackgroundWorker.

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

Sidebar

Related Questions

I have been developing an application with django and elementtree and while deploying it
I am developing an application in that after making a web service I got
I've been developing .net console applications using C# and have always just dictated what
I am developing an application in which i am getting xml from web.But some
I'm developing a map application in Silverlight. I have a type Polygon, containing the
I am developing an application in which I am getting a XML file from
Environment: Windows,Python,wxpython and Element tree as xml parser. I am developing a stand alone
Developing a .NET WinForms application: how can I check if the window is in
Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.
When developing a desktop application in .NET, is it possible to not require the

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.