private void btnInstanceLogout_Click(object sender, EventArgs e) { // Create a new Batch instance // Logs onto the CSM with "AdvancedDemo" application // and "FormId" station Batch b = new Batch("AdvancedDemo", "FormId"); // Do something here... MessageBox.Show("AppName is: " + b.ApplicationName); // Logs out fromn the CSM b.Logout(); // Dispose the batch instance // and disconnect from the CSM // The Dispose() will not // log out from the CSM if the // Logout() has been called // If Logout() has not been called // then Dispose() will perform // the log out. // In any case Dispose() should always // be called. b.Dispose(); }