Wai,
One thing you could do is simply set the ColumnOrder property to rearrange your grid:
with thisform.grid
.columns[1].ColumnOrder = 3
.columns[2].ColumnOrder = 1
.columns[3].ColumnOrder = 2
endwith
Also there is no need to do the following lines in your other code:
> .COLUMNS[i].REMOVEOBJECT('Text1')
> .COLUMNS[i].ADDOBJECT('Text1','Textbox')
> .COLUMNS[i].CURRENTCONTROL = 'Text1'
> .COLUMNS[i].VISIBLE = .T.
You are removing the display control and then just putting the same thing back into the column.
>i hv choose to use manual display the data from the table by adding column one by one( use coding not use grid builder)
>but the sequence of the column display is not follow my coding, thta's mean the sequence is only the dtable column sequnce, not setting by me.
>example
>in table A some field field1, field2, field3 (in sequnce)
>
>but i want to display the fields in sequnce: field2, field3, field1
>
>my coding is:
>* GRD_INFO IS AN ARRAY THAT GRD[x,1] CONTAIN THE HEADER, AND GRD_INFO[x,2] CONTAIN THE FIELD NAME
>WITH THISFORM.GRID
> .RECORDSOURCE = 'TABLE'
> .COLUMNCOUNT = 3
> FOR I = 1 TO 3
> SELECT SODETAIL
> .COLUMNS[I].FORECOLOR = RGB(0,0,0)
> .COLUMNS[i].REMOVEOBJECT('Text1')
> .COLUMNS[i].ADDOBJECT('Text1','Textbox')
> .COLUMNS[i].HEADER1.CAPTION = GRD_INFO[I,1]
> .COLUMNS[i].HEADER1.ALIGNMENT = 0
> .COLUMNS[i].CONTROLSOURCE = GRD_INFO[I,2]
> .COLUMNS[i].CURRENTCONTROL = 'Text1'
> .COLUMNS[i].VISIBLE = .T.
> .COLUMNS[i].SPARSE = .T.
> ENDFOR
>ENDWITH
>
>but the grid display field sequnce is only just the database once setup sequence.
>pls help!