this.recordsource = 'MyTable' Text To cClassCode noshow define class MyHeader as header name = 'MyHeader' proc Click * Create an Index and use it local lcFileName, lcField lcFileName = 'mhtest' + sys(3) + '.idx' lcField = this.caption index on &lcField to (lcFileName) thisform.refresh() EndProc EndDefine EndText StrToFile(cClassCode,"c:\xx.prg") Set Library To c:\xx.prg ADDITIVE local lnFields, laFields[1], lnI with this * For every field in the chosen table add a column lnFields = afields(laFields) .ColumnCount = 0 for lnI = 1 to lnFields .AddColumn(lnI) with .Columns[lnI] * Remove the old header and add ours .RemoveObject('Header1') .AddObject('Header1', 'MyHeader') .Header1.Caption = laFields[lnI, 1] .ControlSource = 'MyTable.' + laFields[lnI, 1] endwith endfor EndWith * oGridHeader = NewObject("MyHeader","c:\xx.prg") * MessageBox(oGridHeader)** In Form_Load
use ? alias MyTable if not used() wait window 'No table was chosen' return .F. endifThat is all your code, from your FAQ, but I only create the class header in the form instead of prg.