I am working on a VFP 9.0 app that has a grid that shows 3 different sets of data depending on a radio button selection. This is why I need to do this programmatically. I need to add a command button to one of the columns. I can add the command button using the IDE and it works fine. But when I add it using the following code all I get is a grey background in the column. I thought it might be because the command button was way to large for the column but this is not the case. For a test I tried to add a check box to the column and it added it and displayed it properly but I could not check the box using the mouse I have no idea why this is not working. Any help you can give me would be greatly appreciated.
Code used to add the command button to a column:
thisform
.grid1.column1.AddObject('commandbutton1','CommandButton')thisform.grid1.column1.Sparse = .f.thisform.grid1.column1.bound= .f.
thisform.grid1.column1.commandbutton1.enabled= .t.
thisform.grid1.column1.CurrentControl = 'commandbutton1'I have tried both .t. and .f. on the bound property and have the same results.
If I can get this working one other question is how/where can I add code for the click event because the command button was added programmatically
Thanks
Rob

Help with adding a button to a grid column programmatically
W_F
Thanks Again
Rob
Kimberley Scott
thisform.grid1.column1.commandbutton1.visible = .t.
You can't add code at runtime (or better say it's not very easy to do). Either create a button class that has necessary code or in VFP8 and later BindEvent() to a custom form event.
Crooks_K