|
' ******************************************************
' 行移動
' nSourceIndex の行を nIndex の行の前に移動する
' nIndexに -1 を指定すると、行の最後に移動
' ******************************************************
Public Sub MoveRow(ByVal nSourceIndex As Integer, ByVal nIndex As Integer)
If nIndex = -1 Then
nIndex = Me.GetRowCount()
End If
Me.Rows.InsertCopy(nSourceIndex, nIndex)
Dim nTarget As Integer = 0
If Me.nCurrentRow >= nIndex Then
nTarget = nSourceIndex + 1
Else
nTarget = nSourceIndex
End If
Dim nCount As Integer = Me.GetColumnCount()
Dim idx As Integer
For idx = 0 To nCount - 1
Me.Rows(nIndex).Cells(idx).Value = Me.Rows(nTarget).Cells(idx).Value
Next
Me.SetRowFlg(nIndex, Me.GetRowFlg(nTarget))
Me.Rows.RemoveAt(nTarget)
End Sub
' ******************************************************
' 行移動
' nCurrentRow の行を nIndex の行の前に移動する
' nIndex に -1 を指定すると、行の最後に移動
' ******************************************************
Public Sub MoveRow(ByVal nIndex As Integer)
Me.MoveRow(Me.nCurrentRow, nIndex)
End Sub
| |