>>Hi Alan,
>>
>>>I’m trying to create a grid programmatically. I don’t know how many columns I will need until run time. I need a way to perform some action when I double click the textbox in a column. I know how to do this when I place a grid on the form from the toolbox by putting 'This.parent.parent.dblclick()' in each textbox, but how can this be done programmatically?
>>
>>First, after creating the column remove the default textbox (the'r may or may not be one, I forget), then define a class (either in code or VCX, doesn't matter) and add programmatically to the grid column. Of course, in the DblCLick of the class add the This.Parent stuff.
>>
>>Good Luck!
>
>Thanks Mike.
>
>When I tried to do this, I set a for loop in the class definition to create the number of columns needed. I get an error that tells me a for loop in invalid in a class definition. Is there a way around this?
Create your classes in class designer. You will need at least 2: grid class and textbox class. Add your code to calculate number of columns to Grid.Init event to set there Grid.ColumnCount property.
Edward Pikman
Independent Consultant