I tried backgroundworker but doesnt work, as i need to update my form with each step and the backgroundworker.progresschanged only works as percentage. and if it were for only one step it could have been done with one. I also thought about making 10 different background workers and doing it that way. but then how would i cacth the exceptions and show the exceptions. and each of my try statements implements excel functions and excel workbook functions. which is also not possible in background worker.
Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
pctrBoxStep1.Image = My.Resources.Yellow1
lblStep1.BackColor = Color.Yellow
workbook.Activate()
Try
'some stuff
Catch ex As Exception
int = -1
pctrBoxStep1.Image = My.Resources.red
lblStep1.BackColor = Color.Red
MessageBox.Show("There was an Error!!" & Environment.NewLine & ex.Message, "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error)
End Try
'Repeat for 9 more steps
End Sub