Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Geovannie Ariola
  Where is Geovannie Ariola?
 Quezon City
 Philippines
 Geovannie Ariola
Subject: RE: Grid value to textbox of another form
Thread ID: 183016 Message ID: 183047 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Friday, July 11, 2008 12:09:34 PM         
   



> >
>
> 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

ENTIRE THREAD

Grid value to textbox of another form Posted by Geovannie Ariola @ 7/11/2008 10:19:26 AM
RE: Grid value to textbox of another form Posted by surinder singh @ 7/11/2008 10:28:39 AM
RE: Grid value to textbox of another form Posted by Geovannie Ariola @ 7/11/2008 11:46:01 AM
RE: Grid value to textbox of another form Posted by Stefan Wuebbe @ 7/11/2008 12:09:34 PM
RE: Grid value to textbox of another form Posted by surinder singh @ 7/11/2008 12:12:32 PM
RE: Grid value to textbox of another form Posted by Samir Ibrahim @ 7/11/2008 1:27:47 PM
RE: Grid value to textbox of another form Posted by Jun Tangunan @ 7/12/2008 7:10:54 AM
RE: Grid value to textbox of another form Posted by tushar @ 7/12/2008 7:31:44 AM
RE: Grid value to textbox of another form Posted by Stefan Wuebbe @ 7/11/2008 10:40:55 AM
RE: Grid value to textbox of another form Posted by Barbara Peisch @ 7/11/2008 8:55:32 PM
RE: Grid value to textbox of another form Posted by Geovannie Ariola @ 7/13/2008 4:18:46 PM