* Grid's Destroy method Local cString As String cString = '' For i = 1 To This.ColumnCount && 1 = Order, 2 = Width cString = cString + Alltrim(Str(This.Columns[i].ColumnOrder)) + Chr(13) cString = cString + Alltrim(Str(This.Columns[i].Width)) + Chr(13) Endfor cFile = "Logs\" + Thisform.Name + This.Parent.Name + This.Name + ".log" && Write the default file for column width If Not File(cFile) And Not Empty(cString) =Strtofile(cString,cFile) Endif If Type('THIS.cGridLog') = 'C' And Not Empty(cString) && Write the users settings =Strtofile(cString,This.cGridLog) EndifIn the grid's intit you can then do something like this
With This If .ColumnCount > 0 Local Array GridOrder(.ColumnCount) Local lnCounter As Integer .cGridLog = Thisform.cLogDir; + Thisform.Name + .Parent.Name + .Name + ".log" If File(.cGridLog) && The user has already been in and out of this screen lcGridLog = .cGridLog Else && Try to use the default grid log if any lcGridLog = "Logs\" + Thisform.Name + .Parent.Name + .Name + ".log" Endif If File(lcGridLog) Alines(GridOrder, Filetostr(lcGridLog)) lnCounter = 1 For i = 1 To .ColumnCount Try .Columns[i].ColumnOrder = Val(GridOrder[lnCounter]) lnCounter = lnCounter + 1 .Columns[i].Width = Val(GridOrder[lnCounter]) lnCounter = lnCounter + 1 Catch Endtry Endfor Endif .SetAll('Bound',.T.,'Column') EndwithThat way, your users can muck about with columnorder and width and you'll never have to worry if it looks good, it'll be their responsibility.