• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 370
  • Last Modified:

Delete selected rows

Hi,

I want to delete selected rows from my dw.
I had written the below code for this.

Long ll_Rows,ll_i

ll_Rows = dw_1.RowCount()
FOR ll_i = 1 To ll_Rows
      IF dw_1.IsSelected(ll_i) THEN
          dw_1.DeleteRow(ll_i)
      END IF
NEXT

It is not deleting all the selected rows. I think, row numbers are changing after first delete.

What is the another way?

Thanks
Srinib
0
srinib
Asked:
srinib
  • 2
1 Solution
 
diasroshanCommented:
hi,

try,

Long ll_Rows,ll_i

//ll_Rows = dw_1.RowCount()
FOR ll_i = 1 to dw_1.RowCount()
     IF dw_1.IsSelected(ll_i) THEN
         dw_1.DeleteRow(ll_i)
     END IF
NEXT


Cheers,
Rosh
0
 
diasroshanCommented:
or try,

Long ll_Rows,ll_i

//ll_Rows = dw_1.RowCount()
FOR ll_i = dw_1.RowCount() to 1 Step -1
     IF dw_1.IsSelected(ll_i) THEN
         dw_1.DeleteRow(ll_i)
     END IF
NEXT


Cheers,
Rosh
0
 
gajender_99Commented:
Long ll_Rows,ll_i

ll_Rows = dw_1.RowCount()
FOR ll_i = 1 to ll_rows
     IF dw_1.IsSelected(ll_i) THEN
         dw_1.DeleteRow(ll_i)
    ll_i=1
    ll_Rows = dw_1.RowCount()
     END IF
NEXT




goodluck
gajender
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now