>>FOR EACH oCol IN this.Columns >> IF UPPER(oCol.CurrentControl.Class) == [TEXTBOX] >> oCol.NewObject([MyText],[YourTextBoxClass],[VCX wher class is defined]) >> oCol.RemoveObject([Text1]) >> oCol.CurrentControl = [MyText] >> oCol.MyText.Visible = .t. >> ENDIF >>ENDFOR >>>
oCol.CurrentControl
is the name and not an object so I added a loop to check each control in the column. This gave me the class name so I can be sure to not change in places I added a custom class. I also added code to use the same text box name. In some of our old stuff we changed the name from text1 sometimes.DoDefault() * Local mName, oCol, oControl FOR EACH oCol IN this.Columns for each oControl in oCol.controls if Upper(oControl.class) == 'TEXTBOX' mName = oControl.name && Keep same name oCol.RemoveObject(mName) oCol.NewObject(mName,[cTextBox],[vjctrl.vcx]) oCol.CurrentControl = mName mcmd = 'oCol.' + mName + '.Visible = .t.' &mcmd EndIf endfor ENDFOR