CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Posts
    177

    Progress Bar Running

    I have the following code:


    Code:
    Private Sub btnConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConfirm.Click
            Try
                CheckSignature()
    
                If flashBMSign = False And flashCustSign = False And flashConsSign = False Then
                    If FnProcessApproval() Then
                        If chkCOOApproval.Checked = True And strRole <> "COO" Then
                            MsgBox("Successfully pass the approval to COO!")
                        Else
                            MsgBox("Successfully Confirm Approval.")
                        End If
                    End If
                End If
            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
            End Try
        End Sub

    May I know how can I put a progress bar to make it keep running when the function FnProcessApproval() is running and stop when the messagebox is display?

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Progress Bar Running

    Look up worker threads, and use System.threading.thread ...

    sample code i use to process reciepts
    Code:
                        If MsgBox("Print receipt for this transaction?", MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton1) = MsgBoxResult.Yes Then
                            Dim WT1 As New System.Threading.Thread(AddressOf PrintReceipt)
                            WT1.Start()
                        End If
    
    
    
    
            Private Sub PrintReceipt()
                Dim TmpPrinter As New Printers.PrinterModule("ID1")
                Dim nr_of_copies As Integer
                For nr_of_copies = 1 To Copies.KeyVal 'get nr. of copies as setup in File/Properties
                    TmpPrinter.Print()
                Next
            End Sub
    In this I spawn a worker thread to take care of all the printing, and can now continue processing the transaction...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Jan 2009
    Posts
    177

    Re: Progress Bar Running

    I tried your code, but how can I embedded my progress bar codes into the thread so that the bar will running?

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

Featured