Really dumb Winforms question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm sure I'm going to feel stupid when someone answers this, but what am I
doing wrong?

I have a simple form that loads a text file and displays it in a listbox
with a progress bar based on the byte size of the file. Once the display
begins, I can't move the form - it just hangs up while it's filling. Also,
if I bring another window into focus, the scrolling display stops and doesn't
come back even if I bring my form back into focus.

This is a simple form I let the forms designer set up for me. What do I
need to change to fix this?
 
Hi,

As Peter said, you might benefit from threading.
There is a simpler, but perhaps not as elegant, way of reading x bytes
from the file, and then use Application.DoEvents() to handle any waiting
windows events like moving the listbox, then read some more, etc, in a
loop.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top