Need to display file processing status

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Geoff Pennington

    Need to display file processing status

    My VB.Net app reads an Excel file, processes it one row at a time, and when
    processing is complete writes the row to a database. The typical file will
    have several thousand rows and may take a couple minutes to process. I would
    like to display a running count of the number of rows processed. It is easy
    enough to keep a counter and set the value of a textbox to the count. I
    expected a high-speed odometer effect, with perhaps only the hundreds column
    on up changing slowling enough to be readable, but instead the screen
    "freezes" until processing is complete, at which point it shows the correct
    count for total records processed. Is there a good way to show status while
    processing is underway?

    Much obliged.


  • One Handed Man

    #2
    Re: Need to display file processing status

    If its a windows project then you can write the record number to a tet
    field, if its a console project then you can display this on the console.

    Regards OHM


    Geoff Pennington wrote:[color=blue]
    > My VB.Net app reads an Excel file, processes it one row at a time,
    > and when processing is complete writes the row to a database. The
    > typical file will have several thousand rows and may take a couple
    > minutes to process. I would like to display a running count of the
    > number of rows processed. It is easy enough to keep a counter and set
    > the value of a textbox to the count. I expected a high-speed odometer
    > effect, with perhaps only the hundreds column on up changing slowling
    > enough to be readable, but instead the screen "freezes" until
    > processing is complete, at which point it shows the correct count for
    > total records processed. Is there a good way to show status while
    > processing is underway?
    >
    > Much obliged.[/color]


    Comment

    • One Handed Man

      #3
      Re: Need to display file processing status

      Sorry, there I go again not reading your post properly

      Stick this in your loop, it should stop it freezing

      System.Windows. Forms.Applicati on.DoEvents()
      OHM



      One Handed Man wrote:[color=blue]
      > If its a windows project then you can write the record number to a tet
      > field, if its a console project then you can display this on the
      > console.
      >
      > Regards OHM
      >
      >
      > Geoff Pennington wrote:[color=green]
      >> My VB.Net app reads an Excel file, processes it one row at a time,
      >> and when processing is complete writes the row to a database. The
      >> typical file will have several thousand rows and may take a couple
      >> minutes to process. I would like to display a running count of the
      >> number of rows processed. It is easy enough to keep a counter and set
      >> the value of a textbox to the count. I expected a high-speed odometer
      >> effect, with perhaps only the hundreds column on up changing slowling
      >> enough to be readable, but instead the screen "freezes" until
      >> processing is complete, at which point it shows the correct count for
      >> total records processed. Is there a good way to show status while
      >> processing is underway?
      >>
      >> Much obliged.[/color][/color]


      Comment

      • Russell Jones

        #4
        Re: Need to display file processing status

        Run the Excel file processing in a separate thread. Raise an event when you
        want to update the textbox, and move the code that updates the textbox back
        into the main form. Use the InvokeRequired and Invoke methods of the TextBox
        control to run the UI update on the UI thread rather than the thread
        processing the Excel file. You can find more information here:





        "Geoff Pennington" <penningtong@st ic2.com.NO!SPAM !> wrote in message
        news:OHqnjuDsDH A.2252@TK2MSFTN GP09.phx.gbl...[color=blue]
        > My VB.Net app reads an Excel file, processes it one row at a time, and[/color]
        when[color=blue]
        > processing is complete writes the row to a database. The typical file will
        > have several thousand rows and may take a couple minutes to process. I[/color]
        would[color=blue]
        > like to display a running count of the number of rows processed. It is[/color]
        easy[color=blue]
        > enough to keep a counter and set the value of a textbox to the count. I
        > expected a high-speed odometer effect, with perhaps only the hundreds[/color]
        column[color=blue]
        > on up changing slowling enough to be readable, but instead the screen
        > "freezes" until processing is complete, at which point it shows the[/color]
        correct[color=blue]
        > count for total records processed. Is there a good way to show status[/color]
        while[color=blue]
        > processing is underway?
        >
        > Much obliged.
        >
        >[/color]


        Comment

        • Armin Zingler

          #5
          Re: Need to display file processing status

          "Geoff Pennington" <penningtong@st ic2.com.NO!SPAM !> schrieb[color=blue]
          > My VB.Net app reads an Excel file, processes it one row at a time,
          > and when processing is complete writes the row to a database. The
          > typical file will have several thousand rows and may take a couple
          > minutes to process. I would like to display a running count of the
          > number of rows processed. It is easy enough to keep a counter and set
          > the value of a textbox to the count. I expected a high-speed odometer
          > effect, with perhaps only the hundreds column on up changing slowling
          > enough to be readable, but instead the screen "freezes" until
          > processing is complete, at which point it shows the correct count for
          > total records processed. Is there a good way to show status while
          > processing is underway?
          >
          > Much obliged.[/color]

          Call the refresh method of the control(s) to be updated. Attention: Using
          WinXP, refresh is ignored after a couple of seconds.


          --
          Armin




          Comment

          • Rolls

            #6
            Re: Need to display file processing status

            Have you tried "Repaint" after the counter is incremented?


            Comment

            Working...