Closing the sample
When you press X to exit the sample, Stop is called. This stops the EtherCAT network and the KINGSTAR Subsystem. Then Destroy is called to close the link to the KINGSTAR Subsystem and terminate the Subsystem.
Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
KS_API.Stop()
KS_API.Destroy()
End Sub