Print Page | Close Window

Deleting Incorrect Row

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=16664
Printed Date: 15 November 2024 at 11:50am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Deleting Incorrect Row
Posted By: XiMaker
Subject: Deleting Incorrect Row
Date 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?



Replies:
Posted By: SuperMario
Date 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



Posted By: XiMaker
Date 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...


Posted By: Aaron
Date Posted: 09 May 2010 at 5:31am
Hi,
 
Is your issue related to https://forum.codejock.com/forum_posts.asp?TID=11560 - 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....



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net