help! progressbar wont show!
-
I have the following in vs sp5:
Public Function CheckingStuff()
'MsgBox "a"
Form1.Text1.Text = "didstuff"
Form1.ProgressBar1.Visible = True
Form1.Show vbModal
'MsgBox "just showed form1"
For i = 0 To 100
Form1.ProgressBar1.Value = i
i = i + 1
NextForm1.ProgressBar1.Visible = False
End Functionthe progressbar shows up blank. What am I doing wrong? Hellpp!!! Thanks, ns
-
I have the following in vs sp5:
Public Function CheckingStuff()
'MsgBox "a"
Form1.Text1.Text = "didstuff"
Form1.ProgressBar1.Visible = True
Form1.Show vbModal
'MsgBox "just showed form1"
For i = 0 To 100
Form1.ProgressBar1.Value = i
i = i + 1
NextForm1.ProgressBar1.Visible = False
End Functionthe progressbar shows up blank. What am I doing wrong? Hellpp!!! Thanks, ns
- Why are you incrimenting 'i' inside the loop that is also incrimenting 'i'? 2) Place a doevents inside the loop to give the screen a chance to update.
-
- Why are you incrimenting 'i' inside the loop that is also incrimenting 'i'? 2) Place a doevents inside the loop to give the screen a chance to update.
I think the problem is that I show the form as modal. So it doesnt get dismissed automatically and get reloaded with the next update? The VC client can only show the dll form as modal (by design according to MS), so I have no choice. So if I preset the progressbar value to 50% OUTSIDE the loop, it shows , but the updates dont show, even with doEvents. I might have to "force" draw a progressbar (two rectangles) onto the modal form with something akin to textout ? The other option I have is to send in the callback functionpointer into the VB dll so it can callback the VC app and notify it of its progress. only thing is, how do I call this function from within VB? eg if my VC app says: ptr->MyVBFunction(& VCCallBAckFunction) Then how will VB call this function? I do a #import in my VC side to let VC know I'm using this VB dll. But what should I tell VB about who the calling app is? Thanks, ns
-
I think the problem is that I show the form as modal. So it doesnt get dismissed automatically and get reloaded with the next update? The VC client can only show the dll form as modal (by design according to MS), so I have no choice. So if I preset the progressbar value to 50% OUTSIDE the loop, it shows , but the updates dont show, even with doEvents. I might have to "force" draw a progressbar (two rectangles) onto the modal form with something akin to textout ? The other option I have is to send in the callback functionpointer into the VB dll so it can callback the VC app and notify it of its progress. only thing is, how do I call this function from within VB? eg if my VC app says: ptr->MyVBFunction(& VCCallBAckFunction) Then how will VB call this function? I do a #import in my VC side to let VC know I'm using this VB dll. But what should I tell VB about who the calling app is? Thanks, ns
I don't believe DoEvents is what you will want to call here, I think you are going to want an API call to UpdateWindow(form1.Hwnd). Nick Parker
**So like children pointers should be left to grown ups. - Norm Alomond
**
-
I don't believe DoEvents is what you will want to call here, I think you are going to want an API call to UpdateWindow(form1.Hwnd). Nick Parker
**So like children pointers should be left to grown ups. - Norm Alomond
**
The problem is not with the loop or doevents. When you open a form in vbmodal then the program execution stops till the window is closed. This has to be used for showing some alert or message where user. Either use vbModeless or else use a timer control to increment progress bar value. dsk:)