Hi Trey,
>>>I'm getting an error on the AddObject line-"Object name is invalid." If I use a different name, i.e. "HeaderA", it works. Why is this and how can I get around it? I really want to name the headers "Header1" because there are pieces of code that depend on the headers being named as such.
>>
>>I don't know WHY the error occurs, but I got it too. So, what I did was the following:
>>FOR EACH loColumn IN This.Columns
>> loColumn.RemoveObject("Header1")
>> loColumn.AddObject("Hdr1","MyHeaderClass")
>> loColumn.Hdr1.Name = "Header1"
>>ENDFOR
>>All is well!
>
>What version are you using?
>I tried this and the original code worked just fine for me - I couldn't make it give me any kind of error.
VFP 6 SP3. I can't remember the specifics of when the error occured, it may have been sporadic. I replace headers in Init() and in ColumnCount_Assign(). The second method hasn't failed me yet.
Bill Armbrecht
VFP MCP