Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot remove header obj from grid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00798376
Message ID:
00798533
Views:
35
Dmitry,

Check you email.

>I just emailed you a test class to see if you will get the same error message.
>
>Please let me know how it works on your pc. Thank you.
>
>>Well, I have the similar code in some of my applciations and I have never met the situation like yours. So I am very interested in finding the cause of error to avoid the possibility of it in the future. Could you send to me your form to reproduce the behavior?
>>
>>>First I tried it with a grid based on a custom class (which as I said in the ininital message works in a lot of forms). Then I thought that maybe I should try basic grid. I did and I still get error "Object name in invalid". Obviously, since the grid already has object Header1 and does not accept another one of the same name.
>>>
>>>Thank you for trying to help me.
>>>
>>>>Is it a regular grid/columns or it is based on custom class?
>>>>
>>>>>I can do both. The problem is that the first example (where you just remove Header1) does not really remove the object (since I see it in the debugger).
>>>>>
>>>>>>Can you do this?
>>>>>>
>>>>>>for each loColumn in thisform.grid.columns
>>>>>>    loColumn.RemoveObject( "Header1" )	
>>>>>>endfor
>>>>>>
>>>>>>
>>>>>>or this?
>>>>>>
>>>>>>
>>>>>>for each loColumn in thisform.grid.columns
>>>>>>    loColumn.RemoveObject( "Header1" )	
>>>>>>    loColumn.AddObject( "Header2", "header" )
>>>>>>endfor
>>>>>>
>>>>>
>>>>>This case also works since you are adding Header2 to the column. But I need to remove Header1 and replaced it with my own Header1.
>>>>>
>>>>>
>>>>>>
>>>>>>>I am trying to remove Header object from a grid and replace it with a custom object. But I get error on line .AddObject because the .RemoveObject does not remove it (I traced it in debugger)
>>>>>>>
>>>>>>>
>>>>>>>for each loColumn in thisform.grid.columns
>>>>>>>    loColumn.RemoveObject( "Header1" )	
>>>>>>>    loColumn.AddObject( "Header1", "custom_header" )
>>>>>>>endfor
>>>>>>>
>>>>>>>
>>>>>>>The strange thing is that I have used this syntax for years in many many forms without any problems. Yet, for some reason now whenever I create a form, the code does not work.
>>>>>>>
>>>>>>>Anybody can see what might be different in all other forms where the code worked and the ones where code does not work?
>>>>>>>
>>>>>>>TIA.
Previous
Reply
Map
View

Click here to load this message in the networking platform