protected void RefreshTabList() { string oldSelection = (TabList.SelectedItem as string) ?? "Scripts"; TabList.BeginUpdate(); TabList.Items.Clear(); TabList.Items.Add("Scripts"); TabList.Items.AddRange(( from k in _Panels.Keys where k != "Scripts" orderby k select k ).ToArray()); try { TabList.SelectedItem = oldSelection; } catch { } TabList.EndUpdate(); }