private void frmQualityInspecting_Shown(object sender, EventArgs e) { GetStations(); equipments.Sort(new Entities.EntityEquipmentInfo_CompareByT133AltCode()); foreach (Entities.EntityEquipmentInfo station in equipments) { XtraTabPage page = new XtraTabPage(); page.Text = string.Format( "[{0}]{1}", station.T133AltCode, station.T107Name); UserControls.ucBatchQualityInspecting inspect = new UserControls.ucBatchQualityInspecting(station); inspect.Dock = DockStyle.Fill; page.Controls.Add(inspect); tcMain.TabPages.Add(page); inspect.ClearAll(); } }
private void tcMain_SelectedPageChanged(object sender, TabPageChangedEventArgs e) { XtraTabPage page = e.Page; foreach (Control ctrl in page.Controls) { if (ctrl is UserControls.ucBatchQualityInspecting) { UserControls.ucBatchQualityInspecting inspect = (UserControls.ucBatchQualityInspecting)ctrl; inspect.ClearAll(); return; } } }