private void FrmBaseTable_VisibleChanged(object sender, EventArgs e) { // close the find and replace form if (frmFind != null) { frmFind.Close(); frmFind = null; } }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmBaseTable(IBaseTable baseTable, TableFilter tableFilter, ScadaProject project, AppData appData) : this() { this.baseTable = baseTable ?? throw new ArgumentNullException("baseTable"); this.tableFilter = tableFilter; this.project = project ?? throw new ArgumentNullException("project"); this.appData = appData ?? throw new ArgumentNullException("appData"); dataTable = null; maxRowID = 0; frmFind = null; Text = baseTable.Title + (tableFilter == null ? "" : " - " + tableFilter); }
private void btnFind_Click(object sender, EventArgs e) { if (frmFind == null || !frmFind.Visible) { frmFind = new FrmFind(this, dataGridView); // center the form within the bounds of its parent frmFind.Left = (ParentForm.Left + ParentForm.Right - frmFind.Width) / 2; frmFind.Top = (ParentForm.Top + ParentForm.Bottom - frmFind.Height) / 2; frmFind.Show(this); } else { frmFind.Activate(); } }