Event from user control not finding variable values in class
Posted on 2001-06-21
Hi. I'm trying to create a DLL to communicate to a serial device. I have the communications working, but now they want to implement a function which requires a timer. I perform 1 write to the device and set the wait duration variable in the timer event. The timer event should call the same function only with different variables. All seems to be going well, but when the timer event fires in the form it calls a function from the device class.(Dataliner.DisplayPermMsg)
When I step through the code after the timer event, I find that the properties in the class that had been set previously are now all empty strings. It is like a new instance of the class has been created and nothing is initialized. The function passed the empty strings instead of the required values and the code completes.
When I send the next message though without using the timer, the previously set class properties are what they should be. I think I'm missing something small, but its stopping the whole thing. I have this same problem with using the DataArrival event of a winsock control and firing procedures or events in another class. Both applications are DLL's. Is there something special about firing events or functions in a class that is part of a DLL? Any and all information to fix this problem would be appreciated.