Search code examples
c#winformsdesktop-application

ComboBox: Adding Text to 0 th index


i tried to add "Selection Option" Text to 0 th index in ComboBox but it showing blank

public void BindDdlPartyAccount()
    {
        PartyAccount objDDlBind = new PartyAccount();
        List<PartyAccount> ListDdlParty = new List<PartyAccount>();
        ListDdlParty = objDDlBind.getDDlPartyDetails();
        objDDlBind.selectOption = "Select Option";
        objDDlBind.selectOptionId = 0;
        ListDdlParty.Insert(objDDlBind.selectOptionId, objDDlBind);
        ddlEditPartyAcc.DataSource = ListDdlParty;
        ddlEditPartyAcc.ValueMember = "PAId";
        ddlEditPartyAcc.DisplayMember = "name";
   }

enter image description here


Solution

  • You should add with the custom object type

    istDdlParty = objDDlBind.getDDlPartyDetails();
    objDDlBind.name= "Select Option";