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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Read the value of the control in a Specific Cell in a grid

Status
Not open for further replies.

Qwark

Programmer
Sep 26, 2000
59
NL
Hello,

How can i get the value of a specific cell in a grid control. The Cell must not be activate. The next code doesn't works because the column control isn't an array:

ThisForm.grdGrid.grcColumn1[2].txtName.value

2 can also be another number.

Can you help me,

Qwark
 
Actually, Grid.Columns is an array, but it doesn't help you because it is not row specific.

Let's approach this from the reverse angle: what is your RecordSource for this grid? Let's assume its a table or cursor. If you know you need the fourth column of the third row, simple move to record 3 (not necessarily recno() 3) and read the fourth field. If the grid columns are not in physical order, you can read the ControlSource for the grid column 4, then use that to figure out which field to read.
Robert Bradley
 
Hi Qwark,

See the columns property in the VFP help file.
The columns collection is a property of the grid object:

ThisForm.grdGrid.Columns[2].txtName.value

or you can refer directly to the column:

ThisForm.grdGrid.grcColumn1.txtName.value

where grcColumn1 is the name of your column. Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
I have the same problem, only with a difference.

In my situation the grids recordsource is set to table 2 and displays amongst others a field that holds the name of a field in table 1.

In the grid, users can enter information about table 1 (for example: field name, field description, type of task to perform on field, etc ...).

I need to display sample data from whichever field they have chosen, but the only time I can successfully access the fields name is when that particular column is selected. So if they move to a different column and scroll down the records, the sample data remains static.

Help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top