Spread WPF Documentation
ClearCustomFunctions Method (GcSpreadSheet)
Example 


GrapeCity.Windows.SpreadSheet.UI Namespace > GcSpreadSheet Class : ClearCustomFunctions Method
Removes all user-defined custom functions (FunctionInfo object) on this sheet.
Syntax
'Declaration
 
Public Sub ClearCustomFunctions() 
'Usage
 
Dim instance As GcSpreadSheet
 
instance.ClearCustomFunctions()
public void ClearCustomFunctions()
Example
This example uses the ClearCustomFunctions method.
public class CubeFunctionInfo : GrapeCity.CalcEngine.Functions.CalcFunction 
    {
        public override string Name { get { return "CUBE"; } }
        public override int MinArgs { get { return 1; } }
        public override int MaxArgs { get { return 1; } }
        public override object Evaluate(object[] args, bool arrayformulamode)
            
        {
            double num = GrapeCity.CalcEngine.CalcConvert.ToDouble(args[0]);
            return num * num * num;
        }
        public override object Evaluate(object[] args, object context, bool arrayformulamode)
    {
        return Evaluate(args, arrayformulamode);
    }
    }

private void button1_Click(object sender, RoutedEventArgs e)
        {
            gcSpreadSheet1.AddCustomFunction(new CubeFunctionInfo());
            // or
            //gcSpreadSheet1.Sheets[0].AddCustomFunction(new CubeFunctionInfo());
            gcSpreadSheet1.Sheets[0].SetFormula(1, 1, "CUBE(4)");
            //gcSpreadSheet1.ClearCustomFunctions();
        }
Public Class CubeFunctionInfo
        Inherits GrapeCity.CalcEngine.Functions.CalcFunction
        Public Overrides ReadOnly Property Name() As String
            Get
                Return "CUBE"
            End Get
        End Property
        Public Overrides ReadOnly Property MinArgs() As Integer
            Get
                Return 1
            End Get
        End Property
        Public Overrides ReadOnly Property MaxArgs() As Integer
            Get
                Return 1
            End Get
        End Property
        Public Overrides Function Evaluate(args As Object(), Optional arrayformulamode As Boolean = False) As Object

            Dim num As Double = GrapeCity.CalcEngine.CalcConvert.ToDouble(args(0))
            Return num * num * num
        End Function
        Public Overrides Function Evaluate(args As Object(), context As Object, Optional arrayformulamode As Boolean = False) As Object
            Return Evaluate(args, arrayformulamode)
        End Function
    End Class

Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
        GcSpreadSheet1.AddCustomFunction(New CubeFunctionInfo())
        ' Or
        'GcSpreadSheet1.Sheets(0).AddCustomFunction(New CubeFunctionInfo())
        GcSpreadSheet1.Sheets(0).SetFormula(1, 1, "CUBE(4)")
        'GcSpreadSheet1.ClearCustomFunctions()
    End Sub
See Also

Reference

GcSpreadSheet Class
GcSpreadSheet Members