locked
Bind an existing ComboBox to Context Menu toolStripComboBox RRS feed

  • Question

  • I've never tried this before and need some assistance on this.

    I have a simple Windows Form that can be minimized to the system tray and has a ContextMenu setup to respond when the system tray icon for the program is right-clicked.

    I already have a ComboBox in the main interface but want to bind it to a toolStripComboBox in the ContextMenu. Not sure how to Bind that data to show in the toolStripComboBox as well.

    Tuesday, July 2, 2013 6:40 PM

Answers

  • Hi Wilddog_00,

    If you just want to make toolStripComboBox and ComboBox use the same data source, you can check below code. If I misunderstood you, please let me know.

    toolStripComboBox1.ComboBox.DataSource = comboBox1.DataSource; 


    Bob Shen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Wilddog_00 Wednesday, July 3, 2013 3:54 PM
    Wednesday, July 3, 2013 8:52 AM

All replies

  • Hi Wilddog_00,

    If you just want to make toolStripComboBox and ComboBox use the same data source, you can check below code. If I misunderstood you, please let me know.

    toolStripComboBox1.ComboBox.DataSource = comboBox1.DataSource; 


    Bob Shen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Wilddog_00 Wednesday, July 3, 2013 3:54 PM
    Wednesday, July 3, 2013 8:52 AM
  • Yes Bob shen is right

    it's with exmaple

    string[] strlist = new string[] { "Test 1", "Test 2", "Test 3", "Test 4" };

                toolStripComboBox1.ComboBox.DataSource = strlist;


    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.

    Wednesday, July 3, 2013 10:04 AM
  • Thanks Bob, that worked perfectly and the data flows in just like on the ComboBox.
    Wednesday, July 3, 2013 3:54 PM