Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / FpSpread Class / EditModeReplace Property
Example


In This Topic
    EditModeReplace Property (FpSpread)
    In This Topic
    Gets or sets whether the existing contents of a cell in the component are selected when that cell enters edit mode.
    Syntax
    'Declaration
     
    Public Property EditModeReplace As Boolean
    'Usage
     
    Dim instance As FpSpread
    Dim value As Boolean
     
    instance.EditModeReplace = value
     
    value = instance.EditModeReplace
    public bool EditModeReplace {get; set;}

    Property Value

    Boolean: true if the existing text in a cell is selected when the cell enters edit mode; false otherwise
    Remarks

    When this property is set to true, when a cell in the spreadsheet enters edit mode, the existing text in the cell is selected. Then, if users start typing, their text replaces the existing text. When this property is set to false, the cursor is placed at the end of the existing text when the cell enters edit mode; new characters are appended to the existing text.

    Note: If you set the EditModePermanent property to true, you might want to set this property to false to prevent users from accidentally deleting their data.

    For a discussion of edit mode and related properties, refer to Understanding Edit Mode.

    Example
    This example specifies whether the existing text in a cell is selected when the cell enters edit mode.
    FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread();
    FarPoint.Win.Spread.SheetView shv = new FarPoint.Win.Spread.SheetView();
    DialogResult dlg;
    fpSpread1.Location = new Point(10, 10);
    fpSpread1.Height = 200;
    fpSpread1.Width = 400;
    Controls.Add(fpSpread1);
    fpSpread1.Sheets.Add(shv);
    fpSpread1.ActiveSheet.SetValue(0, 0, "Replace");
    dlg = MessageBox.Show("Do you want to replace the text??", "EditModeReplace", MessageBoxButtons.YesNo);
    if (dlg == DialogResult.Yes)
    {
         fpSpread1.EditMode = true;
         fpSpread1.EditModeReplace = true;
    }
    Dim fpSpread1 As New FarPoint.Win.Spread.FpSpread()
    Dim shv As New FarPoint.Win.Spread.SheetView()
    Dim dlg As DialogResult
    fpSpread1.Location = New Point(10, 10)
    fpSpread1.Height = 200
    fpSpread1.Width = 400
    Controls.Add(fpSpread1)
    fpSpread1.Sheets.Add(shv)
    fpSpread1.ActiveSheet.SetValue(0, 0, "Replace")
    dlg = MessageBox.Show("Do you want to replace the text??", "EditModeReplace", MessageBoxButtons.YesNo)
    If dlg = DialogResult.Yes Then
         fpSpread1.EditMode = True
         fpSpread1.EditModeReplace = True
    End If
    See Also