Problem in thread

Sani Love 50 Reputation points


I start a thread in my main form and inside it I call a module, inside that module, I process some files, after each file, I call:


which is:

Public Delegate Sub IncreaseProgressBarCallback()
Public Sub IncreaseProgressBar()
If MAPIProgressBarX.InvokeRequired Then
   Invoke(Sub() MAPIProgressBarX.Value = MAPIProgressBarX.Value + 1)
   MAPIProgressBarX.Value = MAPIProgressBarX.Value + 1
End If
End Sub

Simply does not work and progress bar won't go through!

Any workaround? :(

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,159 questions
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,077 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Karen Payne MVP 31,001 Reputation points

    Consider looking at IProgress<T> using Report method. Check out a basic example here.

  2. Jiachen Li-MSFT 13,566 Reputation points Microsoft Vendor

    Hi @Sani Love , Try the following code to see if it helps.

    MainForm.Invoke(New IncreaseProgressBarCallback(AddressOf MainForm.IncreaseProgressBar))

    Best Regards.

    Jiachen Li

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments