Use an additional parameter for the labels position
Code:
Delegate Sub SetLabelTextInvoker(ByVal lblInfo As Label, ByVal Text As String, ByVal lblposition As Integer)
Sub SetLabelText(ByVal lblInfo As Label, ByVal Text As String, ByVal lblposition As Integer)
If lblInfo.InvokeRequired = True Then
lblInfo.Invoke(New SetLabelTextInvoker(AddressOf SetLabelText), lblInfo, Text, lblposition)
Else
lblInfo.Text = Text
lblInfo.Left = lblposition
End If
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim lblposition As Integer
lblposition = (Me.Width / 3) - (lblinfo.Width / 4)
SetLabelText(lblinfo, "File is being copied and will take a while. Please Wait...", lblposition)
BackgroundWorker1.ReportProgress(20)
Copy_5GB_Image()
lblposition = (Me.Width / 3) - (lblinfo.Width / 4)
SetLabelText(lblinfo, "Image Copied Successfully.", lblposition)
End Sub