I had been programming for more than 6 months (and learning VB as this is my first contact with it) an application that uses AHMI to capture data and send database results to two PLC's (a Control Logix and a SLC 505). So far has been working really fine using v3.54, but this week has been a nightmare related to VB. I been getting an error message for "Cross-Threading operation not valid..." when trying to write or read labels from another thread. This is something I was not aware of, as never happened before and I just been reading for two days how to solve it, with little success. Too complicated for something simple like changing a text box content (text property) when a serial.datareceived event is triggered, that is to use a delegate method (still not quite getting how it works, but it works). See second method in here:
http://www.dreamincode.net/forums/blog/143/entry-2337-handling-the-dreaded-cross-thread-exception/I have two questions for anybody who would help me before I loose all my hair:
1. This method solves the write issue, but not when you read. How can you do that?
2. If my application has lots of portions of code like this since day one, why did not happened before? This is what is more disturbing, as I been experimenting "changes" like this for one day to another that cannot be explained.
I already tested my previous versions to see if I changed something but all the previous versions do the same thing. Even took a new hard drive, installed everything from zero and tried again but getting to the same point, so I really do not understand why this is happening.
Any help will be really appreciated.