No Screen Updates while processing in Visual Basic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alfredo73
    New Member
    • Feb 2009
    • 12

    No Screen Updates while processing in Visual Basic

    Hi,

    I am using Visual Basic 2008 to create some databases. It reads data from textfiles and puts them in SQL databases. After the user presses the Process button I would like to give the user to get some feedback of the process simply by for example label1.text += "Processing File 2".
    But during the process no Screen Updates are made...only after all databases are processed and VB.net is waiting for new user response it updates my label1.text.
    Is there any setting to change this are a better way to give user feedback during a process ?

    Thanks in advance !
  • chrisli
    New Member
    • Nov 2008
    • 11

    #2
    I dont know, how is your code build up...but..why don't you use a loop, to go through all the files and after every file you can set your label text or something like that.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Chrisli's recommendation of using a loop is great.

      The only thing that you have to remember is to actually refresh the UI (User Interface) when you want to display an update on the progress.

      To do this use the Control.Update method. This method causes the control to redraw.

      -Frinny

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        If you want to keep sections of your window from turning white (un-updated) when other windows cover them, be sure to call Application.DoE vents() in your loop.

        Comment

        • raids51
          New Member
          • Nov 2007
          • 59

          #5
          Like Plater said, make sure to put application.doe vents somewhere in your loop. If your loop is going to take a long time to finish you also might want to think about putting it into another thread... i wouldnt recomment it though because it can get hard to do cross threading communication

          Comment

          Working...