> >
>
> Sorry! I think I have to be specific with my question?
>
> This is the scenario:
>
> I have this main form with a textbox, a search button and an execute button. The other other form is the search form.
>
> This is how I want it to work:
> 1. The user will open the form then click the search button then the second form will appear (search form with a gridbox in it).
> 2. When the second form appears the user will select (ex. an item number). On the selected value the user will double click it and the value of the grid will go to the textbox of the main form and the search form (2nd form) will disappear.
>
> This is my code but non of the grid value goes to the textbox of the main form. See below code:
>
> Main form (as PO)
>
> search button click:
> DO FORM \forms\search.scx
>
>
> On the search form.
>
> grid.double click:
> po.text1.value = thisform.grid1.column1.text1.value
> thisform.release
You can watch your desired values in the debugger when you for instance temporarily add a line "Set Step On" right before the "po.text1.value = thisform.grid1.column1.text1.value".
FWIW, grid.DblClick() may not run when the current row contains data - except when you have grid.AllowCellSelection=.F. or when you explicitly forward the event in grid.ColumnX.Text1.DblClick().
And it might be easier to evaluate the grid.RecordSource ailias.field directly (instead of "thisform.grid1.column1.text1.value").
And you can "encapsulate" your code in various ways (instead of using a global "po" reference):
For instance, since the search.SCX may be Modal(?), you can "Return yourDesiredValue" in searchForm.Unload() and the receive it in a "To" variable in the calling procedure:
* search button click:
Local lcDesiredResult
DO FORM \<font color="Blue">forms\search.scx To lcDesiredResult
Thisform.yourTextbox.Value = m.lcDesiredResult
hth
-Stefan