update label text

Hi all experts
how can i update the label text when a process take place, it's update at the end of the process in a do while statement, im pass the code in the part that im call the label whit the text i need it, but puts the text until the end of the process and i need it at the begining

thank you a lot

Do While b
                a = Maestro.Item(0, c).Value
                If a = "T" Then

                    Label3.Text = "Migrando SPEC " & Maestro.Item(1, c).Value & " por favor espere...."


                    Dim qry4 As String = "delete  from  proj.pipe_padp"
                    Dim cmd4 As New OleDbCommand(qry4, cn5)
                    estatus = CInt(cmd4.ExecuteScalar())
                    ProgressBar1.Value = 1

                    Dim qry6 As String = "INSERT INTO [1010].proj.PIPE_PADP SELECT * FROM [PASO1008].proj.PIPE_PADP "
                    Dim cmd6 As New OleDbCommand(qry6, cn5)
                    estatus = CInt(cmd6.ExecuteScalar())
                    ProgressBar1.Value = 2

Open in new window

Who is Participating?
Mike TomlinsonMiddle School Assistant TeacherCommented:
The "quick fix" is to call Application.DoEvents() after setting the Label text (each time).

The "proper" way to do it is via threading as sabeesh suggests.
You can crate a background worker thread and update the label text using this thread.
ErnestoAuthor Commented:
code code pleasee
ErnestoAuthor Commented:
got it
thank you a lot
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.