Changing column positions in code

Hi all, Does anyone know if there any way of changing the column position in a grid programatically? I know that a user can do it and that gets stored in his Zup file, but there doesn’t appear to be any way to do this in code which seems like an oversight if this is the case. Changing the columns in the table isn’t an option as the column order should be different for different circumstances for the same table. Thanks for any help! -=- Brett

I’m not sure it is possible. As an alternative, what about putting your column twice in the form in dynamically set the VISIBLE property of one or the other? OnOpenForm() IF MyCondition THEN BEGIN CurrForm.Ctrl1.VISIBLE(TRUE); CurrForm.Ctrl2.VISIBLE(FALSE); END ELSE BEGIN CurrForm.Ctrl1.VISIBLE(FALSE); CurrForm.Ctrl2.VISIBLE(TRUE); END;You can also disable the user changes by setting the form property SaveTableView to “No”

Try this code : The column you want to change position : The column that is used as a reference for the new position of IsVisible := CurrForm.<Column B>.VISIBLE; CurrForm.<Column B>.VISIBLE(TRUE); // To set the column <A> before column <B> CurrForm.<Column A>.XPOS := CurrForm.<Column B>.XPOS; // To set the column <A> after column <B> CurrForm.<Column A>.XPOS := CurrForm.<Column B>.XPOS + CurrForm.<Column B>.WIDTH; CurrForm.<Column B>.VISIBLE(IsVisible); NOTE: I tried with <IsVisible := CurrForm.“Document Date”.VISIBLE(TRUE)> but it seems to Set the property before assign the status Hope that helps