VB 6.0中使用msflexgrid控件,删除选中行的同时删除数据库的内容

2024-12-28 17:48:06
推荐回答(1个)
回答1:

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