Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Deleting Incorrect Row
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Deleting Incorrect Row

 Post Reply Post Reply
Author
Message
XiMaker View Drop Down
Groupie
Groupie
Avatar

Joined: 11 December 2009
Location: United States
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote XiMaker Quote  Post ReplyReply Direct Link To This Post Topic: Deleting Incorrect Row
    Posted: 06 May 2010 at 1:09pm
I have an odd issue where I am deleting records from the reportcontrol and everything works like it should most of the time but at some point even when nothing else has changed, it will start deleting rows 2 or 3 lines below where the focusedrow is located.   during the debug phase I can see that the selectedrow.record contains the correct information that should be deleted but when I issue the removeat and then populate the row 2 or 3 lines below will go away. if I try to delete the same row again it throws an error like the correct row does not exist but it is showing on the reportcontrol row.   ANY IDEAS?
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2010 at 1:42pm

Possibly you want

rptMainMessages.Records.RemoveAt(row.Record.Index);
rptMainMessages.Populate();

OR

rptMainMessages.RemoveRecordEx(row.Record.Index);
rptMainMessages.RowEx(row);

OR

Sub Delete()
Dim i As Long, Row As ReportRow
 If lst.SelectedRows.Count = 0 Then
    If lst.Records.Count = 0 Then
       Debug.Print "No Row(s) Exist to Remove"
    Else
       Debug.Print "Select The Row(s) you want to remove"
    End If
 ElseIf lst.SelectedRows.Count >= 1 Then
         Debug.Print "Ready TO Remove : " & lst.SelectedRows.Count & " Row(s)"
         If MsgBox("Are You Sure", vbInformation + vbYesNo) = vbNo Then
           lblStatus.Caption = "Remove cancelled"
           Exit Sub
         End If

         For Each Row In lst.SelectedRows
             Delete Row
             lst.Records.RemoveAt (Row.Record.Index)
         Next
        
         Debug.Print "Selected Rows removed successfully"
         lst.Populate
 End If
End Sub

Back to Top
XiMaker View Drop Down
Groupie
Groupie
Avatar

Joined: 11 December 2009
Location: United States
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote XiMaker Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2010 at 2:11pm
using the rptMainMessages.RemoveRecordEx(row.Record.Index); seems to have done the trick - I was consistently having the problem before using the RemoveAt and have not been able to reproduce the problem at all when using RemoveRecordEx - thanks...
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2010 at 5:31am
Hi,
 
Is your issue related to https://forum.codejock.com/forum_posts.asp?TID=11560 Are you removing records within the SelectedRows collection? If I remove a record with .RemoveRecordEx(row.record)  or  .RemoveAt(row.record.index) method shouldn't make a difference. Can you show code you used when it didn't work?
 
Thanks
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.