Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Need help repostioning records
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Need help repostioning records

 Post Reply Post Reply
Author
Message
ChaosM View Drop Down
Newbie
Newbie


Joined: 26 November 2007
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote ChaosM Quote  Post ReplyReply Direct Link To This Post Topic: Need help repostioning records
    Posted: 31 January 2008 at 11:19am
Hello,
 
I would like to add the ability to move a selected record up or down in the report control. The docs say that "InsertAt" will move the record where I want, however it's only creating a copy of the record and placing it in the new location. Also, both the original record and the copied record have the same record.index value. I am using the first column as a treeview and there are children.
 
I have tried both of the following with the same results
 
 
        Case ID_MOVEUP
            Set Record = rc.SelectedRows(0).Record
            NewIndex = Record.Index - 1
            rc.Records.InsertAt NewIndex, Record
            rc.Populate
 
        Case ID_MOVEUP
            rc.Records.InsertAt _
                   rc.SelectedRows(0).Record.Index - 1, _ 
                   rc.SelectedRows(0).Record
            rc.Populate
 
 
Is this the better way?  Is there an example?
 
Thank you!
 
Back to Top
ChaosM View Drop Down
Newbie
Newbie


Joined: 26 November 2007
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote ChaosM Quote  Post ReplyReply Direct Link To This Post Posted: 31 January 2008 at 11:33am
Actually i got it to work by removing the old record first. Not sure if this is the intended design.
 
        Case ID_MOVEUP
            Set Record = rc.SelectedRows(0).Record
            NewIndex = Record.Index - 1
            rc.Records.RemoveAt Record.Index
            rc.Records.InsertAt NewIndex, Record
            rc.Populate
 
        Case ID_MOVEDOWN
            Set Record = rc.SelectedRows(0).Record
            NewIndex = Record.Index + 1
            rc.Records.RemoveAt Record.Index
            rc.Records.InsertAt NewIndex, Record
            rc.Populate
 
 
Still interested in knowing if why InsertAt didnt just move the record just by passing the new record.index.
 
Thanks
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.172 seconds.