Visual FoxPro Tips
 
MS Active X Grid
 
Sometimes when you build grids you want to set what columns to show and what the headers would be, don't you? It's easy with native VFP grid. On the other hand MS Active X grids have nice capabilities like multi-line headers, word wrapping, and displaying hierarchical sets in one grid like a treeview.
 
MS Active-X controls offer a useful option to 'Retrieve structure' when you right click on control at design time. This works in VB but does it work in VFP? Fortunately there is a way to do it :) Say you already prepared oConnection and oRecordset and your code assigning DataSource looks like this:
 
oConnection = ...
oRecordset = ...
this.Datasource = oRecordset
 
Click MS Active X grid on the form and add temporary code to make it look like this:
 
oConnection = ...
oRecordset = ...
aSelObj(arrObj)
arrObj.Datasource = oRecordset
this.Datasource = oRecordset
 
Click MS Active X grid on the form and add temporary code to make it look like this:
 
oConnection = ...
oRecordset = ...
aSelObj(arrObj)
arrObj.Datasource = oRecordset
this.Datasource = oRecordset
 
Select the code up to but excluding 'this.Datasource...' line, right click and 'Execute selection'. Voila now when you select 'Retrieve structure' you can set which fields to show, their order, headers and so in the property pages.
 
Note: Foxy Classes users can see a hot implementation of this tip with some other features added in the next update of Foxy Classes.
 
This tip is provided to you by Foxy Classes. For more Visual FoxPro tips, click here.
 
 
   
   
Send mail to webmaster@engineerica.com with questions or comments about this web site.
Copyright 2002-2003 Engineerica Systems, Inc.