Spread ASP.NET 18
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread.Model Namespace / DefaultSheetDataModel Class / RemoveColumns Method
Index of first column to remove
Number of columns to remove
Example


In This Topic
    RemoveColumns Method (DefaultSheetDataModel)
    In This Topic
    Removes one or more columns starting with the column at the specified position.
    Syntax
    'Declaration
     
    
    Public Sub RemoveColumns( _
       ByVal column As Integer, _
       ByVal count As Integer _
    ) 
    'Usage
     
    
    Dim instance As DefaultSheetDataModel
    Dim column As Integer
    Dim count As Integer
     
    instance.RemoveColumns(column, count)
    public void RemoveColumns( 
       int column,
       int count
    )

    Parameters

    column
    Index of first column to remove
    count
    Number of columns to remove
    Exceptions
    ExceptionDescription
    Specified column is out of range; must be between 0 and total number of columns
    Specified number of columns is out of range; must be between 1 and total number of columns beyond the specified starting column
    Example
    This example creates a new DefaultSheetDataModel, sets its number of rows and columns in the constructor and attaches it to the DataModel of the active sheet. Data is added to the first cell in the first three columns. In a button click event the RemoveColumns method removes the first two columns.
    Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
    
    If(Me.IsPostBack)Then Return
    
    Dim dm As New FarPoint.Web.Spread.Model.DefaultSheetDataModel(8,8)
    FpSpread1.ActiveSheetView.DataModel=dm
    FpSpread1.ActiveSheetView.SetValue(0,0,"First")
    FpSpread1.ActiveSheetView.SetValue(0,1,"Second")
    FpSpread1.ActiveSheetView.SetValue(0,2,"Third")
    End Sub
    
    Private Sub Button1_Click(ByVal sender As Object,ByVal e As System.EventArgs)Handles Button1.Click
    Dim dm As FarPoint.Web.Spread.Model.DefaultSheetDataModel=FpSpread1.ActiveSheetView.DataModel
    dm.RemoveColumns(0,2)
    End Sub
    private void Page_Load(object sender,System.EventArgs e)
    {
    if(this.IsPostBack)return;
    
    FarPoint.Web.Spread.Model.DefaultSheetDataModel dm=new FarPoint.Web.Spread.Model.DefaultSheetDataModel(8,8);
    FpSpread1.ActiveSheetView.DataModel=dm;
    FpSpread1.ActiveSheetView.SetValue(0,0,"First");
    FpSpread1.ActiveSheetView.SetValue(0,1,"Second");
    FpSpread1.ActiveSheetView.SetValue(0,2,"Third");
    }
    
    private void Button1_Click(object sender,System.EventArgs e)
    {
    FarPoint.Web.Spread.Model.DefaultSheetDataModel dm=(FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel;
    dm.RemoveColumns(0,2);
    }
    See Also