Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding columns with methods to a grid 1

Status
Not open for further replies.

chpicker

Programmer
Apr 10, 2001
1,316
Does anyone know how to add columns to a grid with methods in them? My program creates a cursor with a variable number of columns, then sets the recordsource of the grid to the cursor. I then make enough columns in the grid to hold the cursor. However, I cannot figure out how to add methods to those newly created columns. I need them to respond, at the very least, to a Keypress event (more specifically, I suppose, the text1 member of the column needs to). The simplest solutions I have already discarded: the WriteMethod method is available at design time only, and you cannot seem to create a class for a column. The grid itself does not respond to keypresses. Does anyone have any ideas?
 
Did you try creating a custom class of the method you'd like to insert into the column (i.e. a text box with the code already in it), then programmatically add the class control to the column and set control to the new text box? If you need a sample, I'll see if I can come up with something in the a.m.
 
Here is some little code:

for i=1 to thisform.myCustomGrid.ColumnCount
thisform.myCustomGrid.column(i).removeobject("text1")
thisform.myCustomGrid.column(i).addobject("myCustomtText")
endfor

where myCustomText is a class designed by your own. Have fun !!!
 
Wow, I didn't think it was going to be that easy! I'm impressed. Thanks for the quick response!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top