c# - How to set first index as blank in combobox -
i have combobox bound datasource.in combobox have add blank field @ index 0.
i have written following code getting records.
public list<tbasubtype> getsubtype(int typ) { using (var tr = session.begintransaction()) { try { list<tbasubtype> lstsubtypes = (from sbt in session.query<tbasubtype>() sbt.ftype == typ select sbt).tolist(); tr.commit(); return lstsubtypes; } catch (exception ex) { cusexception cex = new cusexception(ex); cex.write(); return null; } } }
after bind combobox data binding source below code.
m3.cm.bal.cm cmobj = new m3.cm.bal.cm(wsession.createsession()); lstsubtypes = cmobj.getsubtype(type); this.tbasubtypebindingsource.datasource = lstsubtypes;
please give me solution problem.any appreciated.thanks
if want select nothing initially, can use
combobox1.selectedindex=-1;
Comments
Post a Comment