Problem with progress bar on separate dialog

gin
03-03-2003, 01:10 AM
Hello,

My program has a progress bar on a separate dialog form. It's updated by code on the original form itself. However, the dialog ends up rather see-through (see attached picture). I'd appreciate advice on how to solve this.

Thanks in advance.

JDT
03-03-2003, 02:00 AM
Without seeing the code I can just make a guess.

I would try to slip DoEvents in there somwhere, like in a loop if you are using one.

gin
03-03-2003, 02:39 AM
Code, huh? Well okay, here's the relevant parts from Form1 (the initial form). ProgressDialog (the form with the progress bar) has no code.

Private Sub cmdGo_Click()
ProgressDialog.ProgressBar1.Min = 0
ProgressDialog.ProgressBar1.Max = FileListBox.ListCount
ProgressDialog.ProgressBar1.Value = 0
ProgressDialog.Show
Form1.Enabled = False
Update
ProgressDialog.Hide
Form1.Enabled = True
Form1.SetFocus
End Sub

Sub Update()
'loop through FileListBox
ProgressDialog.ProgressBar1.Value = ProgressDialog.ProgressBar1.Value + 1
'rename a file
'end loop
End Sub

Hmm, didn't the VB code format use to have color formatting?

JDT
03-03-2003, 02:51 AM
We have upgraded to vb3 and the vb tags have not yet had the color added to them.

See if this works with the doevents:Sub Update()
'loop through FileListBox
ProgressDialog.ProgressBar1.Value = ProgressDialog.ProgressBar1.Value + 1
DoEvents
'rename a file
'end loop
End Sub

gin
03-03-2003, 03:45 AM
Thank you, this works great. If you don't mind, could you tell me what precisely DoEvents does? I read somewhere that it "should be placed inside time-consuming loops", but that doesn't tell me too much.

Squirm
03-03-2003, 04:14 AM
It allows the Operating System to process any outstanding messages, such as those for drawing and for input.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum