Hi!
I modified your code:
TempDBF="C:\TEMP\TEMP.DBF"
thisform.GridRefreshing = .T.
close tables
copy file (SourceDBF) to (TempDBF)
use (TempDBF) again alias "MyAlias"
with thisform.MyGrid
.RecordSource = "MyAlias"
.column1.controlsource="MyAlias.Field1"
.column2.controlsource="MyAlias.Field3"
.column3.controlsource="MyAlias.Field5"
.column4.controlsource="MyAlias.Field7"
endwith
thisform.Refresh
DOEVENTS
thisform.GridRefreshing = .F.
thisform.Refresh
thisform.MyGrid.SetFocus
>Hi Vlad,
>
>Thanks a lot for the information, now I can prevent the grid from reconstructing and the layout is just exactly what I want.
>
>I wish I'm not asking too much but I still have problem now :\
>
>After using the new method, the grid can only show the first record of the table, not only this, if the table has 10 records, the grid would also have 10 rows each showing the first record of the table.
>
>my code to trigger the Grid update is:
>
>TempDBF="C:\TEMP\TEMP.DBF"
>
>thisform.GridRefreshing = .T.
>
>close tables
>copy file "&SourceDBF" to "&TempDBF"
>use &TempDBF
>
>with thisform.MyGrid
> .RecordSource = "&TempDBF"
>
> .column1.controlsource="Field1"
> .column2.controlsource="Field3"
> .column3.controlsource="Field5"
> .column4.controlsource="Field7"
>endwith
>
>thisform.Refresh
>DOEVENTS
>thisform.GridRefreshing = .F.
>
>
>At design time, the init value of RecordSourceType of the grid is "table", RecordSource is "TEMP". Also for each column I have set the init value of controlSource as above.
>
>Thanks a lot for your attention and any help would be greatly appreciated!
>
>Jimi
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.