System.Windows.Forms.ComboBox.ObjectCollection.Remove(object)

Here are the examples of the csharp api class System.Windows.Forms.ComboBox.ObjectCollection.Remove(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

12 Examples 7

1. Example

Project: KeeAnywhere
Source File: ImageComboBox.cs
View license
public void ComboBoxRemoveItem(ImageComboBoxItem item)
		{
			base.Items.Remove (item);
		}

2. Example

Project: fomm
Source File: DropDownTabControl.cs
View license
private void RemoveTabPage(object sender, TabPageEventArgs e)
    {
      var ctlPage = e.TabPage;
      ctlPage.PageIndexChanged -= PageIndexChanged;
      ctlPage.TextChanged -= PageTextChanged;
      TabSelector.Items.Remove(ctlPage);
      foreach (var page in TabPages)
      {
        if (page.PageIndex > ctlPage.PageIndex)
        {
          page.PageIndex--;
        }
      }
      if (SelectedTabPage == ctlPage)
      {
        if (TabPages.Count == 0)
        {
          SelectedTabPage = null;
        }
        else if (SelectedIndex == TabPages.Count)
        {
          SelectedIndex--;
        }
        else
        {
          SelectedIndex++;
        }
      }
      Controls.Remove(e.TabPage);
    }

3. Example

Project: NetOffice
Source File: TrayMenu.cs
View license
internal void OnDropDownItem_ListItemRemoved(TrayMenuDropDownListItem item, object listItem, int listItemIndex)
        {
            ToolStripComboBox targetStrip = Find(item) as ToolStripComboBox;
            if (null != targetStrip)
                targetStrip.Items.Remove(listItem);
        }

4. Example

View license
private void RemoveTabPage(object sender, DropDownTabControl.TabPageEventArgs e)
		{
			DropDownTabPage ctlPage = e.TabPage;
			ctlPage.PageIndexChanged -= new EventHandler(PageIndexChanged);
			ctlPage.TextChanged -= new EventHandler(PageTextChanged);
			m_cbxSelector.Items.Remove(ctlPage);
			for (Int32 i = 0; i < m_tpcPages.Count; i++)
				if (m_tpcPages[i].PageIndex > ctlPage.PageIndex)
					m_tpcPages[i].PageIndex--;
			if (SelectedTabPage == ctlPage)
			{
				if (m_tpcPages.Count == 0)
					SelectedTabPage = null;
				else if (SelectedIndex == m_tpcPages.Count)
					SelectedIndex--;
				else
					SelectedIndex++;
			}
			Controls.Remove(e.TabPage);
		}

5. Example

View license
private void comboBoxSelectProvider_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            BlogProviderDescriptionProxy blogProvider = comboBoxSelectProvider.SelectedItem as BlogProviderDescriptionProxy;

            if (blogProvider != BlogProviderDescriptionProxy.SelectProvider)
            {
                textBoxServerApiUrl.Text = blogProvider.PostApiUrl;
                labelServerAPIUrl.Text = Res.Get(blogProvider.PostApiUrlLabel);

                // remove the special SelectProvider entry if it exists
                if (comboBoxSelectProvider.Items.Contains(BlogProviderDescriptionProxy.SelectProvider))
                    comboBoxSelectProvider.Items.Remove(BlogProviderDescriptionProxy.SelectProvider);
            }
            else
            {
                textBoxServerApiUrl.Text = String.Empty;
            }
        }

6. Example

View license
protected void RemoveOption(AlignmentOption option)
        {
            if (comboBoxValue.Items.Contains(option))
                comboBoxValue.Items.Remove(option);
        }

7. Example

Project: SmartStoreNET
Source File: Extensions.cs
View license
public static void RemoveCurrent(this ComboBox combo)
		{
			combo.Items.Remove(combo.Text);
			combo.ResetText();
		}

8. Example

View license
private void RemoveAvailableFilter(DeviceFilterNode filter)
        {
            SelectNextAvailableFilter(filter);
            _cbAvailableFilters.Items.Remove(filter);
            UpdateUI();
        }

9. Example

Project: mRemoteNG
Source File: QuickConnectComboBox.cs
View license
protected override void OnKeyDown(KeyEventArgs e)
		{
			base.OnKeyDown(e);
			if (e.KeyCode == Keys.Enter)
			{
				// Only connect if Enter was not pressed while the combo box was dropped down
				if (!_ignoreEnter)
				{
					OnConnectRequested(new ConnectRequestedEventArgs(_comboBox.Text));
				}
				_ignoreEnter = false;
				e.Handled = true;
			}
			else if (e.KeyCode == Keys.Delete & _comboBox.DroppedDown)
			{
				if (_comboBox.SelectedIndex != -1)
				{
					// Items can't be removed from the ComboBox while it is dropped down without possibly causing
					// an exception so we must close it, delete the item, and then drop it down again. When we
					// close it programmatically, the SelectedItem may revert to Nothing, so we must save it first.
					var item = _comboBox.SelectedItem;
					_comboBox.DroppedDown = false;
					_comboBox.Items.Remove(item);
					_comboBox.SelectedIndex = -1;
					if (_comboBox.Items.Count != 0)
					{
						_comboBox.DroppedDown = true;
					}
				}
				e.Handled = true;
			}
		}

10. Example

Project: lua-tilde
Source File: FindReplaceDialog.cs
View license
private void UpdateHistory(ComboBox comboBox)
		{
			if (comboBox.Text != "")
			{
				string text = comboBox.Text;
				if (comboBox.Items.Contains(text))
					comboBox.Items.Remove(text);

				comboBox.Items.Insert(0, text);
				comboBox.Text = text;
				StoreInRegistry(comboBox);
			}
		}

11. Example

Project: My-FyiReporting
Source File: PropertyCtl.cs
View license
private void SetPropertyNames()
        {
            if (_NameCollection != _Draw.ReportNames.ReportItemNames)
            {
                cbReportItems.Items.Clear();
                _NameCollection = _Draw.ReportNames.ReportItemNames;
            }
            else
            {   // ensure our list count is the same as the number of report items
                int count = cbReportItems.Items.Count;
                if (cbReportItems.Items.Contains(this.REPORT))
                    count--;
                if (cbReportItems.Items.Contains(this.GROUP))
                    count--;
                if (cbReportItems.Items.Contains(this.NONAME))
                    count--;
                if (count != _NameCollection.Count)
                    cbReportItems.Items.Clear();        // we need to rebuild
            }

            if (cbReportItems.Items.Count == 0)
            {
                cbReportItems.Items.Add(this.REPORT);
                foreach (object o in _NameCollection)
                {
                    cbReportItems.Items.Add(o);
                }
            }
            else
            {
                try
                {
                    cbReportItems.Items.Remove(this.GROUP);
                }
                catch { }
                try
                {
                    cbReportItems.Items.Remove(this.NONAME);
                }
                catch { }
            }
        }

12. Example

Project: XmlNotepad
Source File: RecentFilesMenu.cs
View license
void AddRecentFileName(Uri fileName) {
            try {
                addingFile = true;
                if (this.recentFiles.Contains(fileName)) {
                    this.recentFiles.Remove(fileName);
                }
                string fname = fileName.IsFile ? fileName.LocalPath : fileName.AbsoluteUri;
                if (this.location.Items.Contains(fname)) {
                    this.location.Items.Remove(fname);
                }
                if (fileName.IsFile && !File.Exists(fileName.LocalPath)) {
                    return; // ignore deleted files.
                }
                this.recentFiles.Add(fileName);
                this.location.Items.Insert(0, fname);
                if (this.recentFiles.Count > maxRecentFiles) {
                    this.recentFiles.RemoveAt(0);
                }
                if (this.location.Items.Count > maxRecentFiles) {
                    this.location.Items.RemoveAt(this.location.Items.Count - 1);
                }
                this.location.SelectedIndex = 0;

            } catch (System.UriFormatException) {
                // ignore bad file names
            } catch (System.IO.IOException) {
                // ignore bad files
            } finally {
                addingFile = false;
            }
        }