If you can live a recordsourcetype 4 it's real easy
1. grid1.recordsource="SELECT * FROM mydbf ORDER BY (public variable or newpropsomewhere) INTO CURSOR mycursor
2. grid1.refresh
3. Header click event add
newpropsomewhere="myfieldname" or variable="Myfieldname"
grid1.recordsource="Select * FROM mydbf ORDER BY (public variable or newpropsomewhere) INTO CURSOR mycursor"
grid1.refresh
This can be place in a builder and you can get really slick with the oop stuff, but for down and dirty this works.
HTH
Jeff
>>>Is there any way to display a grid sorted by column - dynamically. I'm changing jobs shortly and don't want to generate too much code on this project as it may be too much for the remaining people here to cope with. I need to be able to say something like grdSample.Column1.Sort() or something similar.
>>
>>Hi Nigel,
>> Create an index tag for each ordering that you want. Put code in the click event of each header object of your grid that changes the current index order. Unfortunately you can't subclass the header class so you will have to insert the code manually. Now each time that the user clicks on a new header the grid will reorder.
>>
>>Hope this helps,
>> Ned Ames
>
>That was one solution I toyed with. Two problems: too many fields and also I don't trust the people here to leave the tables/indexes alone. Non technical people here have VFP installed!!! Some horror stories (recently somebody deleted a vital table, somebody else moved a folder, somebody else renamed the public folder on the network - I'm glad I'm going!).
It's Time to get a gun.
That's what I've been thinkin.
I think I can afford one, If I do a little less Drinkin.www.TrueGeeks.com