Spread Windows Forms 6.0 Product Documentation
Swap Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.Model Namespace > IRangeSupport Interface : Swap Method


fromRow
Row index from which to begin swap
fromColumn
Column index from which to begin swap
toRow
Row index of the destination range
toColumn
Column index of the destination range
rowCount
Number of rows to swap
columnCount
Number of columns to swap

Glossary Item Box

Swaps a range of cells from one specified location to another.

Syntax

Visual Basic (Declaration) 
Sub Swap( _
   ByVal fromRow As Integer, _
   ByVal fromColumn As Integer, _
   ByVal toRow As Integer, _
   ByVal toColumn As Integer, _
   ByVal rowCount As Integer, _
   ByVal columnCount As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As IRangeSupport
Dim fromRow As Integer
Dim fromColumn As Integer
Dim toRow As Integer
Dim toColumn As Integer
Dim rowCount As Integer
Dim columnCount As Integer
 
instance.Swap(fromRow, fromColumn, toRow, toColumn, rowCount, columnCount)
C# 
void Swap( 
   int fromRow,
   int fromColumn,
   int toRow,
   int toColumn,
   int rowCount,
   int columnCount
)

Parameters

fromRow
Row index from which to begin swap
fromColumn
Column index from which to begin swap
toRow
Row index of the destination range
toColumn
Column index of the destination range
rowCount
Number of rows to swap
columnCount
Number of columns to swap

Example

This example swaps the data between the specified range and the specified location.
C#Copy Code
FarPoint.Win.Spread.Model.IRangeSupport irs;
DialogResult dlg;
Random r = new Random();
int i, j;
for (i = 0; i<=4; i++)
{
for (j = 0; j<=4; j++)
fpSpread1.ActiveSheet.SetValue(i, j, r.Next(1, 200).ToString());
}
irs = (FarPoint.Win.Spread.Model.IRangeSupport)fpSpread1.ActiveSheet.Models.Data;
dlg = MessageBox.Show("Do you want to swap some data?", "Swap", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
irs.Swap(0, 0, 2, 2, 2, 2);
}
Visual BasicCopy Code
Dim irs As FarPoint.Win.Spread.Model.IRangeSupport
Dim dlg As DialogResult
Dim r As New Random()
Dim i, j As Integer
For i = 0 To 4
For j = 0 To 4
FpSpread1.ActiveSheet.SetValue(i, j, r.Next(1, 200).ToString())
Next j
Next i
irs = FpSpread1.ActiveSheet.Models.Data
dlg = MessageBox.Show("Do you want to swap some data?", "Swap", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
irs.Swap(0, 0, 2, 2, 2, 2)
End If

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

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