Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. help! progressbar wont show!

help! progressbar wont show!

Scheduled Pinned Locked Moved Visual Basic
visual-studiohelpquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    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
    Next

    Form1.ProgressBar1.Visible = False
    End Function

    the progressbar shows up blank. What am I doing wrong? Hellpp!!! Thanks, ns

    R 1 Reply Last reply
    0
    • N 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
      Next

      Form1.ProgressBar1.Visible = False
      End Function

      the progressbar shows up blank. What am I doing wrong? Hellpp!!! Thanks, ns

      R Offline
      R Offline
      Ray Cassick
      wrote on last edited by
      #2
      1. 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.
      N 1 Reply Last reply
      0
      • R Ray Cassick
        1. 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.
        N Offline
        N Offline
        ns
        wrote on last edited by
        #3

        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

        N 1 Reply Last reply
        0
        • N 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

          N Offline
          N Offline
          Nick Parker
          wrote on last edited by
          #4

          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


          **

          D 1 Reply Last reply
          0
          • N Nick Parker

            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


            **

            D Offline
            D Offline
            dsk
            wrote on last edited by
            #5

            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:)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups