Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

issue with datasockets initialized in constructor of user control

I notice that if I create a "user control" in C# and instruct a data socket to connect to a data socket server in the constructor of the user control, when the user control is dropped onto a form, the data socket connection is made. This is expected.

Unfortunately, when the form is closed, the data socket connection remains open, and I have to close Microsoft Visual Studio to terminate the data socket connection. (Closing the solution does not work).

Does anybody have a solution to this problem?

Thanks,

Shea
0 Kudos
Message 1 of 2
(2,970 Views)
You need to call DataSocket.Dispose in the Dispose method of the User Control. You want to call it inside the if (disposing) block.
0 Kudos
Message 2 of 2
(2,966 Views)