0
我正在使用VB6並且在其中使用MSFlexGrid現在我想刪除用戶選擇的完整行,並且一旦自動完成,將焦點設置爲文本框,同時在Internet上搜索有用的,但問題是,當我點擊按鈕,它刪除所有的行,即使是第一行,這是FlexGrid的頭,我不想刪除第一行。如何從msflexgrid中刪除所選項目
這裏是代碼
Private Sub cmdDell_Click()
Dim i As Integer
With grdArticles 'the msflexgrid
If .RowSel <> 0 Then 'check if there is a selected row
For i = .RowSel To .Rows - 2 'loop from selected row to the las row
.TextMatrix(i, 0) = .TextMatrix(i + 1, 0) 'set rows with 1 back
.TextMatrix(i, 1) = .TextMatrix(i + 1, 1)
.TextMatrix(i, 2) = .TextMatrix(i + 1, 2)
.TextMatrix(i, 3) = .TextMatrix(i + 1, 3)
Next i
.Rows = .Rows - 1 'make the rows 1 less
Else
MsgBox "Selecet row to delete!!!", vbExclamation
End If
End With
End Sub