Hello friends,
I have a VB project with MDI container and MDI parent.
On MDI container I have one progressbar
I need to update the progress bar during execution of sql query run in a SUB (MDI parent)
In the sub I have this code
Try
'Executing some query under transaction
'Begin transaction
Trans = DBcon.BeginTransaction(
"Elabora Statistiche")
DBcmd.Connection = DBcon
DBcmd.Transaction = Trans
Query1 (I need progress bar value set to 20)
DBcmd.CommandText = SqlString
DBcmd.ExecuteNonQuery()
Query2 (I need progress bar value set to 40)
DBcmd.CommandText = SqlStringDBcmd.ExecuteNonQuery()
Query3 (I need progress bar value set to 60)
DBcmd.CommandText = SqlStringDBcmd.ExecuteNonQuery()
Query4 (I need progress bar value set to 80)
DBcmd.CommandText = SqlStringDBcmd.ExecuteNonQuery()
Trans.Commit()
Trans.Dispose()
(I need progress bar value set to 100)
CatchexAsException
MsgBox(
"Errore nell'elaborazione statistiche"& vbCrLf & ex.Message, MsgBoxStyle.Critical,"Elaborazione Statistiche")
EndTry
'I need to reset the progress bar value to 0 if there was used
Can u help me?
I've try many solutions (Backgroundworker, thread, public sub) but the progress bar can't update during Try
Thank u !!!!