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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -