Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Header problem
Message
From
26/07/2011 04:27:15
 
 
To
25/07/2011 22:11:29
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01519130
Message ID:
01519153
Views:
41
As Namoi also mention, use a "safe select" which means that you never change the grid's recordsource. In your form's init:
SELECT cusno,cusname FROM cusmas  where .F. INTO CURSOR cusmas_srh readwrite && create an empty cursor to drive the grid
Index on cusno tag cusno
This will replace ALL the code you showed:
SELECT cusno,cusname FROM cusmas  INTO CURSOR curtemp readwrite && A temp cursor
SELECT cusmas_srh && Which drives the grid
ZAP
Append from dbf('curtemp')
GO top
Use in curtemp && Not really necessary
thisform.grdClient.Refresh()
thisform.grdClient.COLUMN1.SetFocus()
NB! This is only my personal opinion, but I find the -> construct "old" and difficult to read. Instead I prefer the newer point easier to read, like cusmas.cusno .

>Hi,
>
>I have a grid on a form and set the column header to BOLD, the caption is Customer Code, Customer Name.
>I have some code in click event on the column header, but after run the select statement, it reset all the setting of the grid,
>the header change to the cursor field name, not bold, the header click event reset to none.
>
>why ?
>
>the code as follow:-
>
>
>SELECT cusmas->cusno,cusmas->cusname FROM cusmas  INTO CURSOR cusmas_srh ORDER BY cusmas->cusno
>SELECT cusmas_srh
>GO top
>thisform.grdClient.RecordSource="cusmas_srh"
>thisform.grdClient.Refresh()
>thisform.grdClient.COLUMN1.SetFocus() 
>
>
>Please advise.
>Thank
>Derek
Previous
Reply
Map
View

Click here to load this message in the networking platform