Good evening all,
This is the first time I have needed to start a new topic, I can usually find the answers via the Google Gods, but not this time – I would very much appreciate your help.
I have written a number of small apps in the past, have come up against this problem before but have managed to fudge it with a simple “refresh” button, but this time, I need the app to refresh the screen automatically (it’s a notification screen for the warehouse operatives).
The VB.net app is simple enough. It a simple form that has a number of static objects. One of the objects is a FlowPanelLayout. Within the FPL I create buttons to represent orders waiting to be picked – click on the order(button) and it displays information about the order.
Because this screen is displaying live information, it need to “refresh” automatically. So, to test, I created a refresh button that calls the sub that first deletes all the buttons, then recreates them based on the results of an SQL query – this all works fine.
So, to automate the refresh, I created a timer that called the same sub as the refresh button, I get an error at the bit of code that removes the existing buttons from the FPL:
“Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.”
So, my questions is, how do I call this sub using the original thread?
I’ve been reading about INVOKE and DELEGATE but it’s not making much sense. I can’t find any examples showing this type of app – windows forms.
This must be quite a common thing – getting an app to refresh it’s data/display.
Thanks in advance for your help