Window / Form refreshing issue

hi,

this is the first time i've looked at windows forms and i know that im just doing something very silly.

I have a simple form which creates a filesystemwatcher with associated events. When a folder has images dropped in it my code is called which updates a ListBox, does some image processing, updates a database and updates a viewer control on the MainWindow form. However when it's processing a number of images one after another the window won't refresh. I've tried adding a this.Refresh() after i update the listbox and viewer, but cannot seem to get it working.

It's a dead simple little app that's designed to chug away and i don't really want to get into threading as it's simply not worth it for this test.

So am i right in assuming that the processing is stopping window refresh events and if so, what method is best to force a refresh during this processing

thanks in advance
paul


Answer this question

Window / Form refreshing issue

  • Lau Han Ching

    The easiest way is probably calling Application.DoEvents() every now and then. It gives the form time to handle all the messages it received (including the refresh messages).
  • Window / Form refreshing issue