combobox RRS feed

  • Question

  • hi all,

    am using combobox in my application, am adding values to combobox dynamically.but at 0th place no item is showing.

    hera is the code.


    sEPC is the array. having some values.

    suppose sEPC is having 




    when am adding to combobox it's showing as

    blank space




    i want it without blank in combobox.

    • Moved by CoolDadTx Monday, October 28, 2013 1:59 PM Winforms related
    Monday, October 28, 2013 12:53 PM


  • So you want to bind a combo to an array?  If so then Add isn't the correct approach.  A combo works with anything and it'll ToString on that object.  If you pass it an array you are not going to be populating it with the array elements.

    To bind an array to a combo you can either manually bind by using Items.AddRange or automatically by assigning the array directly to DataSource.  In both cases the array elements will be added to the combo.  If you need to add items in addition to the array then Items is probably the easier route.

    Refer to MSDN for an example.

    Michael Taylor

    Monday, October 28, 2013 1:59 PM