Spread for ASP.NET 7.0 Product Documentation
RemoveRow Method
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetDataModel Class : RemoveRow Method


row
Index of row to remove

Glossary Item Box

Removes a row at the specified position.

Syntax

Visual Basic (Declaration) 
Public Sub RemoveRow( _
   ByVal row As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As DefaultSheetDataModel
Dim row As Integer
 
instance.RemoveRow(row)
C# 
public void RemoveRow( 
   int row
)

Parameters

row
Index of row to remove

Exceptions

ExceptionDescription
System.ArgumentOutOfRangeException Specified row is out of range; must be between 0 and total number of rows

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 RemoveRow method removes the first row.
Visual BasicCopy Code
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 A sSystem.EventArgs)Handles Button1.Click
Dim dm As FarPoint.Web.Spread.Model.DefaultSheetDataModel=FpSpread1.ActiveSheetView.DataModel
dm.RemoveRow(0)
End Sub
C#Copy Code
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.RemoveRow(0);
}

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

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.