protected void OnClosePressed(object sender, EventArgs e) { if (tabSearchs.SelectedIndex < 0) { return; } if (tabSearchs.SelectedIndex == tabSearchs.TabPages.Count - 1) { m_OnEndSearch((int)tabSearchs.TabPages[tabSearchs.SelectedIndex].Tag); } int tabIndexToRemove = (int)tabSearchs.TabPages[tabSearchs.SelectedIndex].Tag; krnGateway.DeleteSearch((int)tabSearchs.TabPages[tabSearchs.SelectedIndex].Tag); tabSearchs.TabPages.RemoveAt(tabSearchs.SelectedIndex); TotalResult.Remove(tabIndexToRemove); TabTitle.Remove(tabIndexToRemove); //SearchesList.Remove(tabIndexToRemove); }