Hi folks,

In my c# epos app, i have a method which does two things:

It calls a method to update the Form with the change to be given to the customer.

It then calls a method to print the receipt to the serial printer.

Even though the update Form method is called first, it doesn't get enough time to update the label for the change (Other labels appear half-updated). THe Form just seems to not update until the printing it over.

I have tried adding Thread.Sleep(10) to the method which does the printing but all this does is just delay the receipt printing....

Any ideas?


8 Years
Discussion Span
Last Post by serkan sendur

hmm ok, as it turns out, i don't think its the serial port writing causing this. I forgot to mention that after the printing method is called, a few other methods are called to stores stuff to a Sqlite database (which is slow). I think it is this that's causing the problem.

Really, what I am looking for is just some tips on how to make sure that the Form is updated before all the rest happens.

Apperently just calling the method first doesn't do this :(



You could consider using a background worker thread, but its not really needed for something like this, call This.Refresh(); to refresh the controls on the form, that should do it, but if your methods use loops, try calling Application.DoEvents(); in the lengthy loop it will allow your form to process win messages sent to the application and allow it to paint as well.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.