Define Class grdColumn As Column FontSize = 8 BackColor = Rgb(255,255,255) ForeColor = Rgb(0,0,0) HeaderClass="ColHeader" HeaderClassLibrary="gridclasslib.prg" Enddefine Define Class ColHeader As Header FontSize = 8 BackColor = Rgb(236,233,216) ForeColor = RGB(255,255,255) Procedure Click Local lcAlias * Sets the Order for a Table Alias when clicked. *IMPORTANT: * This method assumes that an index tag has been created for each column of the grid * AND that the tag is named identically to the field name for the column. Private all **- Need to test the controlsource has an alias lcAlias = (Juststem(This.Parent.ControlSource)) If Used(lcAlias) Select (Juststem(This.Parent.ControlSource)) fieldname = Upper(Justext(This.Parent.ControlSource)) If Len(fieldname) > 10 fieldname = Left(fieldname, 10) EndIf Do Case Case TagNo(m.fieldname)>0 AND (Tag()#m.fieldname OR Descending()) Set Order To (m.fieldname) Ascending If PemStatus(ThisForm, "lDescending", 5) ThisForm.lDescending = .F. EndIf If PemStatus(ThisForm, "cSortOrder", 5) ThisForm.cSortOrder = fieldname EndIf Case TagNo(m.fieldname)>0 Set Order To (m.fieldname) Descending If PemStatus(ThisForm, "lDescending", 5) ThisForm.lDescending = .T. EndIf If PemStatus(ThisForm, "cSortOrder", 5) ThisForm.cSortOrder = fieldname EndIf EndCase Goto Top Thisform.Refresh EndIf EndProc EnddefineNow on you grid control set the MemberClass to grdColumn (navigate to the prg and select the grdColumn class)