C# Returning Types from a method -


if have method returns datagridview , flow similar this:

if (ds.tables.count == 0)         {             sharedmethods.updatestatus("there no excluded results display");             //return dgv;         }         else         {             dgv.datasource = ds.tables[0];             dgv.autosizecolumnsmode = datagridviewautosizecolumnsmode.allcells;             dgv.allowusertoaddrows = false;              return dgv;         } 

if if condition true not want return datagridview(as there no data), can return in case? if return null, calling method has null datagridview causes later problems.

thanks.

just set grid's visible property false if have nothing show.


Comments

Popular posts from this blog

sql server - python to mssql encoding problem -

java - SNMP4J General Variable Binding Error -

c# - BasicHttpBinding equivalent CustomBinding using WCF Client and PHP WebService -