I am repeating to what is already responded in the above posts (Olaf/Mike)
Example, to show 'FirstName', 'LastName' and 'ID' in the grid.
Assuming grid name is 'Grid1'
in the init() of the form add the following code. All this can be done through IDE as well.
Code:
with thisform.Grid1
.columncount = 3
.recordsource = 'customer' && Alias of your search table
.deletemark = .f.
.readonly = .f.
.recordmark = .f.
.gridlines = 1
.gridlinecolor = rgb(235,245,235)
.gridlinewidth = 2
.scrollbars = 2 && Vertical
.column1.width = 60
.column1.controlsource = "customer.FIRSTNAME"
.column1.Header1.caption = "FirstName"
.column1.Header1.fontbold = .f.
.column1.Header1.fontunderline = .f.
.column1.readonly = .t.
.column1.fontsize = 10
.column2.width = 60
.column2.controlsource = "customer.LASTNAME"
.column2.Header1.caption = "LastName"
.column2.Header1.fontunderline = .f.
.column2.readonly = .t.
.column2.text1.fontsize = 9
.column3.width = 60
.column3.controlsource = "customer.ID"
.column3.Header1.caption = "Cust ID"
.column3.Header1.fontunderline = .f.
.column3.readonly = .t.
.column3.text1.fontsize = 9
endwith
Add some 'TextBox' controls such as 'FirstName', 'LastName', 'Custmer ID', and more.
Then in the 'AfterRowColChange()' event assign values to these controls such as
thisform.txtFirstName.value = FIRSTNAME
thisform.txtLastName.value = LASTNAME
thisform.txtCustID.value = ID
thisform.txtOtherField.value = OtherField && Any other field
When using 'Up' 'Down' keys on Grid1, the contents of the CURRENTLY SELECTED record will be reflected in the 'TextBox' controls (thisform.txtFirstName, thisform.LastName, etc)
Note: FIRSTNAME, LASTNAME and ID are the field names of the search table.
I hope this will help.
Nasib