private void frmMain_FormClosing(object sender, FormClosingEventArgs e) { // check if the virtual handset is currently connected if (Handset.IsConnected()) { // disconnect the virtual handset when you close the app! Handset.Disconnect(); } }