Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with RemoveObject
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00215737
Message ID:
00215745
Views:
27
>I think WITH .. ENDWITH may be resolved at compile time. You should probably put the entire reference to text1 in lcRemoveObject:
>
>lcRemoveObject = 'thisform.grdCatalog.column' + ALLTRIM(STR(lnI)) + '.text1'
>
>>WITH thisform.grdCatalog
>> .ColumnCount= 9
>> FOR lnI = 1 TO .ColumnCount
>> lcRemoveObject = '.column' + ALLTRIM(STR(lnI)) + '.text1'
>> .RemoveObject(lcRemoveObject)
>> lcAddObject = '.column' + ALLTRIM(STR(lnI)) + '.txtbase1'
>> .AddObject(lcAddOjbect, 'txtBase')
>>ENDFOR
>>
>>I am trying to execute the above code and keep getting an error message on the remove object line. It says that '.Column1.text1' is not an object.
>>
>>What am I doing wrong? How do you remove one object and insert another?

You need to do RemoveObject() and AddObject from the column level, not the grid, even though you mention the column in the string, try something like
For each loGrdColumn in Thisform.MyGrid.Columns
   lcCurContrl = loGrdColumn.CurrentControl
   if not empty( lcCurControl )
     loGrdColumn.RemoveObject( lcCurContrl )
   endif

   loGrdColumn.AddObject( "textbase1", "yourtextboxcontrol" )
EndFor
Previous
Reply
Map
View

Click here to load this message in the networking platform