Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Visual Basic - Update progress bar on MDI container from Sub on MDI parent

$
0
0

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 = SqlString

DBcmd.ExecuteNonQuery()

Query3 (I need progress bar value set to 60)

DBcmd.CommandText = SqlString

DBcmd.ExecuteNonQuery()

Query4 (I need progress bar value set to 80)

DBcmd.CommandText = SqlString

DBcmd.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 !!!!

 


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>