Spread for ASP.NET 8.0 Product Documentation
RemoveRows(Int32,Int32) Method
Example 


Index of first row to remove
Number of rows to remove
Removes one or more rows, starting with the specified row.
Syntax
'Declaration
 
Public Sub RemoveRows( _
   ByVal row As Integer, _
   ByVal count As Integer _
) 
'Usage
 
Dim instance As DefaultSheetDataModel
Dim row As Integer
Dim count As Integer
 
instance.RemoveRows(row, count)
public void RemoveRows( 
   int row,
   int count
)

Parameters

row
Index of first row to remove
count
Number of rows to remove
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeException Specified row is out of range; must be between 0 and total number of rows
System.ArgumentOutOfRangeException Specified number of rows is out of range; must be between 1 and total number of rows beyond the specified starting row
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 some cells in the first three columns. In a button click event the RemoveRows method removes the first two rows.
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(1,0,"Second");
FpSpread1.ActiveSheetView.SetValue(2,0,"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.RemoveRows(0,2);
}
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(1,0,"Second")
FpSpread1.ActiveSheetView.SetValue(2,0,"Third")
End Sub

PrivateSubButton1_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesButton1.Click
DimdmAsFarPoint.Web.Spread.Model.DefaultSheetDataModel=FpSpread1.ActiveSheetView.DataModel
dm.RemoveRows(0,2)
EndSub
Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

DefaultSheetDataModel Class
DefaultSheetDataModel Members

 

 


Copyright © GrapeCity, inc. All rights reserved.