MSHFlexGrid批量删除后刷新的问题
数据库里是删除了但表格里没有即时刷新
Private Sub Command9_Click()
Dim i As Long
With MSHFlexGrid1
For i = 1 To .Rows - 1 '循环删除选种的行
If .TextMatrix(i, 0) = "√ " Then '删除选中的行
~~~~~这里加什么代码MSHFlexGrid里可以即时刷新表格内容Adodc1.Recordset.ActiveConnection.Execute "Delete From Data Where " & Adodc1.Recordset.Fields(0).Name & "= ' " & Trim(MSHFlexGrid1.TextMatrix(i, 1)) & " ' "
End If
Next i
End With
End Sub
[解决办法]
从最后一行往上循环step -1
如果数据库删除成功就MSHFlexGrid1.RemoveItem i