Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

Previous Property, CellClass Class

Returns the previous cell in the item's cell collection.

Class: CellClass
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public CellClass Previous { get; }
Public ReadOnly Property Previous As CellClass

Value

The previous cell or null/Nothing if there is no previous cell.

Comments

Returns the previous cell in the item's cell collection.

The previous cell is not necessarily the previous displayed cell. The CellClass.PreviousDisplayed property can be used to retrieve the previous displayed cell.

The Previous property returns the previous cell in the cell collection, CellClass.PreviousDisplayed returns the previous displayed cell.

This property traverses cells one by one, even if cells are part of a group of merged cells. To traverse groups of merged cells, use CellClass.PreviousMainCell instead.

Examples

C#

        // Button part Action event
        void bp_Action(object sender, ActionEventArgs e) {
            // this is our button that was just clicked
            ButtonPartClass bp = (ButtonPartClass)e.Part;
            // this is the cell containing the button
            CellClass cell = (CellClass)bp.PartOwner;
            // get the previous cell
            cell = cell.Previous; 
            // this cell's first (and only) part is a progressbar (in this example)
            ProgressBarPartClass pbp = (ProgressBarPartClass) cell.Parts[0];
            // increment the progressbar's Value property
            int val;
            if (pbp.Value == pbp.Max)
                val = 0;
            else
                val = pbp.Value + 10;

VB.NET

' Button part Action event
Private Sub bp_Action(ByVal sender As Object, ByVal e As ActionEventArgs)
    ' this is our button that was just clicked
    Dim bp As ButtonPartClass = e.Part
    ' this is the cell containing the button
    Dim cell As CellClass = bp.PartOwner
    ' get the previous cell
    cell = cell.Previous
    ' this cell's first (and only) part is a progressbar (in this example)
    Dim pbp As ProgressBarPartClass = cell.Parts(0)
    ' increment the progressbar's Value property
    Dim Val As Integer
    If pbp.Value = pbp.Max Then
        Val = 0
    Else
        Val = pbp.Value + 10

See Also CellClass Class | Classes | SftTree/NET 2.0