get Value In Spread

Posted by: zxx2403 on 8 September 2017, 12:42 pm EST

  • Posted 8 September 2017, 12:42 pm EST

    I get the value of Cell as follow


    Spread1.ActiveSpread.Cells.Get(0,2).Value.ToString();


    But  if  the Cell not have been assigned value.


    The .net will throw a Exception


    How I can Do .


    give me a example


     


       thank you

  • Replied 8 September 2017, 12:42 pm EST

    Hello,


    The ToString method will throw an exception if it is called on a null object. You need to check to make sure the Value is not null before calling the ToString method.

     
    if(Spread1.ActiveSpread.Cells.Get(0,2).Value!=null)
    Spread1.ActiveSpread.Cells.Get(0,2).Value.ToString();
     
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels