>Hi, everyone,
>
>I have a grid control on one of my forms, which display the results of SELECT command. It works fine and it displays the results. Is there anyway that I can pass the value of any cell to a memory variable. Let’s say I want to pass the value of a cell on first column in the second record. Can I do such I thing and how?
>
>Thanks
>
>M. Sameer
Mohammed,
Since your result of SELECT command is just a VFP cursor, you can use various VFP commands to do that. The value in certain grid cell is a value of one of fields in your cursor, when positioned on certain record.
As an example, to get the value from the second record, assuming the first grid column displays CLIENT_NAME field:
GO 2
myVariable = mytable.client_name
If you don't know what is the field name you can use Column.Controlsource property to get the value.
myVariable = EVAL(thisform.grid1.column1.ControlSource)
You also can get the value of the selected grid cell programmatically from the Grid.Value property, but this works only when Grid has the focus, so you could use a code like this:
thisform.grid1.ActivateCell(2,1) && second grid row, first column
thisform.grid1.SetFocus()
myVariable = thisform.grid1.value
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison