private void SurveysControl_VisibleChanged(object sender, EventArgs e) { if (!this.Visible) { if (this.currentControl != null) { this.Controls.Remove(currentControl); currentControl.Dispose(); currentControl = null; } } }
private void PropretyChanged(object o, PropertyChangedEventArgs e) { if(e.PropertyName != null) { if (o != null) { currentControl = (ResultsControl)o; this.Controls.Add(currentControl); currentControl.BringToFront(); currentControl.Show(); } else { OnNotifyPropertyChanged(e.PropertyName); } } }