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

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -