Spread for ASP.NET 11 Product Documentation
AddColumns Method (DefaultSheetDataModel)
Example 


FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetDataModel Class : AddColumns Method
Index of column at which to add a new column
Number of columns to add
Adds one or more columns to the data model at the specified position.
Syntax
'Declaration
 
Public Sub AddColumns( _
   ByVal column As Integer, _
   ByVal count As Integer _
) 
'Usage
 
Dim instance As DefaultSheetDataModel
Dim column As Integer
Dim count As Integer
 
instance.AddColumns(column, count)
public void AddColumns( 
   int column,
   int count
)

Parameters

column
Index of column at which to add a new column
count
Number of columns to add
Exceptions
ExceptionDescription
Specified column index is out of range; must be between zero and the number of columns
Specified number of columns is out of range; must be greater than zero
Remarks

If you want to add a single column, use the AddColumn method.

Example
This example shows the use of this method by adding a new column to the model in the click event of a button and placing it in front of the fourth column.
 Private void Button1_Click(object sender, System.EventArgs e)
{
  FarPoint.Web.Spread.Model.DefaultSheetDataModel dm = (FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel;
  dm.AddColumns(2, 2);        
}
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  Dim dm As FarPoint.Web.Spread.Model.DefaultSheetDataModel = CType(FpSpread1.ActiveSheetView.DataModel, FarPoint.Web.Spread.Model.DefaultSheetDataModel)
  dm.AddColumns(2, 2)
End Sub
See Also

Reference

DefaultSheetDataModel Class
DefaultSheetDataModel Members
AddColumn Method
RemoveColumn Method
RemoveColumns Method