Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Delete Multiple Selectd Rows in Flex Grid

Status
Not open for further replies.

dass

Programmer
Feb 25, 2002
33
0
0
IN
How to Delete Multiple Selectd Rows in Flex Grid

I add 5 rows in flex grid

I want to select 1st and 3rd row and delete then
Can it posible
please any one suggest me
 

hai
Random deletion is not possible in FlexGrid, but you can delete rows selected continuosly, use the below code in the keydown event of the flexgrid
I think it will help u


'**********************************************************************
' sDeleteTraining (SUB)
'
' PARAMETERS:
' None
'
' DESCRIPTION:
' To delete the record partially from the grid Training
'**********************************************************************
Sub sDeleteTraining()
On Error Resume Next
Dim itraverse
Dim start, hcount
If mshfgTraining.RowSel > 0 And bDelQualify = False Then
For itraverse = 1 To mshfgTraining.Rows - 1
If mshfgTraining.Highlight Then
start = mshfgTraining.row
Exit For
End If
Next itraverse
hcount = mshfgTraining.RowSel
End If
Dim idRow, idCol As Integer ' vars for delrow and del column
idRow = 0
idCol = 1
With mshfgTraining
For itraverse = start To hcount
aDelTraining(idRow, idCol) = .TextMatrix(itraverse, 1)
aDelTraining(idRow, idCol + 1) = .TextMatrix(itraverse, 2)
aDelTraining(idRow, idCol + 2) = .TextMatrix(itraverse, 3)
'aDelTraining (idRow, idCol + 3) = .TextMatrix(itraverse, 4)
idRow = idRow + 1
idCol = 1
bDelTraining = True
Next itraverse
End With
iDelCountTraining = 0
For itraverse = start To hcount
mshfgTraining.TextMatrix(itraverse, 1) = ""
mshfgTraining.TextMatrix(itraverse, 2) = ""
mshfgTraining.TextMatrix(itraverse, 3) = ""
iDelCountTraining = iDelCountTraining + 1
Next itraverse
For itraverse = hcount To start Step -1
If mshfgTraining.Rows > 2 Then
If itraverse >= 1 Then mshfgTraining.RemoveItem (itraverse)
mshfgTraining.Highlight = flexHighlightNever
End If
Next itraverse

End Sub
=============
Regards
Mathi Krishna

KEEP SMILING TODAY AND ALWAYS
 
thank for your suggestion it help me but i want to know what is this

With Msf
For itraverse = start To hcount
aDelTraining(idRow, idCol) = .TextMatrix(itraverse, 1)
aDelTraining(idRow, idCol + 1) = .TextMatrix(itraverse, 2)
aDelTraining(idRow, idCol + 2) = .TextMatrix(itraverse, 3)
'aDelTraining (idRow, idCol + 3) = .TextMatrix(itraverse, 4)
idRow = idRow + 1
idCol = 1
bDelTraining = True
Next itraverse
End With

 
hai
aDeltraining is a variant array where the deleted record is saved temp for retrieveing it again, start and hcount are var for knowing the selected area and storing the values in the variant array
Ok
Regards,
Mathi Krishna
KEEP SMILING TODAY AND ALWAYS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top