Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / SheetView Class / NonEmptyColumnCount Property
Example


In This Topic
    NonEmptyColumnCount Property (SheetView)
    In This Topic
    Gets a value that is one more than the index of the last column on this sheet containing data.
    Syntax
    'Declaration
     
    Public ReadOnly Property NonEmptyColumnCount As Integer
    'Usage
     
    Dim instance As SheetView
    Dim value As Integer
     
    value = instance.NonEmptyColumnCount
    public int NonEmptyColumnCount {get;}

    Property Value

    Integer number of columns that have data
    Remarks

    This property is dependent on the data model for the sheet (Models.Data) implementing the INonEmptyCells interface. If this interface is not implemented on the selection model, then this property returns -1.

    This property is available at run time only.

    Example
    This example illustrates the use of this member by returning a value that is one more than the index of the last column and row containing data.
    Random r = new Random();
    int countc, countr;
    int i, j;
    for (i = 0; i<=50; i++)
    {
        for (j = 0; j<=3; j++)
            fpSpread1.ActiveSheet.SetValue(i, j, r.Next(1, 200).ToString());
    }
    countc = fpSpread1.ActiveSheet.NonEmptyColumnCount;
    countr = fpSpread1.ActiveSheet.NonEmptyRowCount;
    label1.Text = "The number of the first non-empty column is " + countc.ToString() + " and the number of the first non-empty
    row is " + countr.ToString();
    Dim r As New Random()
    Dim i, j, x As Integer
    Dim countc, countr As Integer
    For i = 0 To 50
        For j = 0 To 3
            FpSpread1.ActiveSheet.SetValue(i, j, r.Next(1, 200).ToString())
        Next j
    Next i
    countc = FpSpread1.ActiveSheet.NonEmptyColumnCount
    countr = FpSpread1.ActiveSheet.NonEmptyRowCount
    Label1.Text = "The number of the first non-empty column is " & countc.ToString() & " and the number of the first non-empty
    row is " & countr.ToString()
    See Also