Print Page | Close Window

InsertAt: move or copy?

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=18922
Printed Date: 12 July 2025 at 5:35pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: InsertAt: move or copy?
Posted By: Albert1
Subject: InsertAt: move or copy?
Date Posted: 08 September 2011 at 10:56am
I am looking for a swap records function. From CJ help:
 
InsertAt will move an existing ReportRecord to the specified index.
 
So I wrote this code:
 

Private Sub Form_Load()
    With ReportControl1
        .Width = 8000
        .Height = 4000
        .Move 0, 0
        .Columns.Add 0, "A", 100, True
        .Columns.Add 1, "B", 100, True
        With .Records.Add
            .AddItem "1.1"
            .AddItem "1.2"
        End With
        With .Records.Add
            .AddItem "2.1"
            .AddItem "2.2"
        End With
        With .Records.Add
            .AddItem "3.1"
            .AddItem "3.2"
        End With
       
        .Records.InsertAt 3, .Records(0)
        .Populate
    End With
End Sub
 
The result is:
 
 
The first record is copied to a new 4th record. This is a copy, not a move. Someone can please confirm it?
 
The best strategy to swap two records by code is InsertAt/RemoveAt
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 13.4.1 / 16.3.0

Platform: Windows Vista (32bit) - SP 2

Language: Visual Basic 6.0 (SP6)




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