Custom cell references and AllowColumnMove

Posted by: branestawm on 8 September 2017, 1:36 pm EST

  • Posted 8 September 2017, 1:36 pm EST

    Hi. I would like to use custom cell names (eg <FONT size=2>FpSpread1.ActiveSheet.AddCustomName(</FONT><FONT color=#a31515 size=2>"CustNo"</FONT><FONT size=2>, </FONT><FONT color=#a31515 size=2>"P1:P2000"</FONT><FONT size=2>, 0, 0)</FONT>) so that when referring to cells throughout my code I can say, eg       


    <FONT color=#0000cc>Dim expr As FarPoint.CalcEngine.ReferenceExpression
            expr = FpSpread1.ActiveSheet.GetCustomName("CustNo")
            column = expr.Column
     CustNo = FpSpread1.ActiveSheet.Cells(e.Row, column).Value</FONT>


    Then if I change the order of columns or add new ones via the bound dataset I only need to change the AddCustomName reference to make all code references to that column work.


    However if I enable AllowColumnMove, the custom name does not keep up with the rearranged order when the user moves a column. Is it possible to automatically reassign CustomNames when the column are moved by the user?


    Thanks. Hope thats clear.


     


     

  • Replied 8 September 2017, 1:36 pm EST

    Have you tried using the ColumnDragMoveCompleted event?  You can try using the FromIndex to get the expression from that column and re-assign it using the ToIndex.
  • Replied 8 September 2017, 1:36 pm EST

    I will give it a try, thanks.
  • Replied 8 September 2017, 1:36 pm EST

    I will give this a try, thanks.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels