private void butDelete_Click(object sender, EventArgs e) { if (MapItem.IsNew) { DialogResult = System.Windows.Forms.DialogResult.Cancel; return; } if (!MsgBox.Show(this, true, "Remove Map Area?")) { return; } MapAreas.Delete(MapItem.MapAreaNum); DialogResult = System.Windows.Forms.DialogResult.OK; }
///<summary>Clear the form. Optionally delete the records from the database. Use this option sparingly (if ever).</summary> public void Clear(bool deleteFromDatabase) { if (deleteFromDatabase) { for (int i = 0; i < this.Controls.Count; i++) { if (!(this.Controls[i] is MapAreaRoomControl)) { return; } MapAreas.Delete(((MapAreaRoomControl)this.Controls[i]).MapAreaItem.MapAreaNum); } } this.Controls.Clear(); }