The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 2 of 2

Thread: No items shown in the ComboBox

  1. #1

    No items shown in the ComboBox


    I am a newer in C#. I created a ComboBox, but it didn't show any items. After clicking, the only item is 'none'. Can anybody help me with this. Thank you!

    Here is part of the code:

    classTestReport : Report

    private ComboBoxtcombo = newComboBox();
    privatestring[] comboNames = { "A1", "A2", "A3", "A4" };
    privateList<string> comboNames2 = newList<string>();
    privatestring secretString2 = "A1";

    public TestReport()
    tcombo.DataSource = comboNames;

    publicComboBox Test
    tcombo.DropDownStyle = ComboBoxStyle.DropDownList;
    return tcombo;
    tcombo = value;
    tcombo.DropDownStyle = ComboBoxStyle.DropDownList;

  2. #2
    You didn't databind your combobox. You need to call the databind method on your combobox after you set the datasource:

    tcombo.DataSource = comboNames;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012