Private Sub Command1_Click()
Dim rSel As Long
With MSFlexGrid1
If .Rows = 0 Or .RowSel = 0 Then Exit Sub
rSel = .RowSel
If rSel <> .Rows - 1 Then
For i = rSel + 1 To .Rows - 1
For j = 1 To .Cols - 1
.TextMatrix(i - 1, j) = .TextMatrix(i, j)
Next
Next
End If
.Rows = .Rows - 1
End With
End Sub
On Error GoTo erro
MSHFlexGrid1.RemoveItem MSHFlexGrid1.Row 删除选定的行
erro: '---不能删最后非固定行,所以写下列这段代码
If err.Number = 30015 Then
MSHFlexGrid1.Clear
End If
这个实现起来比较麻烦,你还不如用dbgrid控件,这样可以直接删除