Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Visa serial session event and Visual Basic

I'm using Visa 8.0 and Visual Basic (Visual Studio 2003) and ran into a problem where my application would stop responding to mouse click events. I'm using the serial session class of the Measurement Studio .NET plugin and the "AnyCharacterReceived" event to read in blocks of data. The serial communications work fine but the UI stops responding to mouse click events when I shut off the device that's sending the data. It only affects the mouse when it's "in" the application. The funny thing is, if I replace the event with a timer tick event that reads data in when available, there's no problem. So it seems to have something to do with the event handler.
 
Alex Specker
Vector Magnetics
 
0 Kudos
Message 1 of 6
(4,437 Views)
Hi Alex,

Do you still see this behavior if you create an example that just uses the AnyCharacterReceived event and a button that updates text values when pressed?  I created an example like this and wasn't able to duplicate the behavior.  Try creating this example and let me know how it works.
0 Kudos
Message 2 of 6
(4,426 Views)
Hi Terry,
 
I don't see the problem with the small test app I created. I only see the problem when I incorporated the serial session event code in an existing VB application. There, it interferes with other events when the serial port is disconnected or closed (disposed).
 
I have another question: Is it possible to close a serial port without "disposing" it? When you dispose the Visa session, it destroys the object and you have to instantiate the class all over again.
 
Thanks,
Alex Specker
0 Kudos
Message 3 of 6
(4,412 Views)
Hi Alex,

What other events are you calling in your application?  Is it possible for you to post a simple example that demonstrates the behavior that you are seeing?

To close the serial port, you will have to call Dispose(), because this method releases all resources that are being used by the SerialSession.
0 Kudos
Message 4 of 6
(4,393 Views)

Terry,

The other events are timer tick events, button click events, and after I receive serial data, I raise an event in the inherited class to pass data up.

I don't have any simple code to post since this only happens in the large GUI, Funny thing is, it doesn't happen in other parts of the code where I have similar code; the Visa events are no problem.

Alex

0 Kudos
Message 5 of 6
(4,387 Views)
Hi Alex,

Since the simple example doesn't demonstrate the behavior, then there is probably a conflict between another event in your program and the AnyCharacterRecieved event.  The best thing to do now to help narrow down where the problem is, is to start removing other events until the problem doesn't occur anymore.  When that happens, please post that code to this forum, so we can take a look at it.  If you have any questions, please let me know.
0 Kudos
Message 6 of 6
(4,374 Views)