Pass values back to main form from a new form being opened.

kaybeekaybee Member Posts: 49
Hi, I wanted to know if this is possible? I have a main form and when the user clicks a button, this launches a new form with an input text field. I want the user to enter a value in this new form and the minute he clicks OK, I can access the user inputted text on the main form via a variable.

How do I do this?

Comments

  • matttraxmatttrax Member Posts: 2,309
    I'm not sure if you can do it this way or not, but you can try it out.

    In form number 2 make a global variable and a function that returns its value.

    In form number 1 make a Form variable that references form number 2.

    You will have to run the form modally, otherwise it will just open the form and keep on executing the code afterwards.

    After that do "Form 2".GetMyVariable and see what happens.

    I have a feeling that once the form is closed, though, all variables are thrown into the garbage collection. You might want to consider using a dialog box and the input method instead.
  • SavatageSavatage Member Posts: 7,142
    Just curious....
    almost sounds like you're using this 2nd form as a Dialog Box only.

    Does the second form have any other use besides a place to enter a text field?
  • kaybeekaybee Member Posts: 49
    Savatage wrote:
    Just curious....
    almost sounds like you're using this 2nd form as a Dialog Box only.

    Does the second form have any other use besides a place to enter a text field?

    Yes, just one textfield. How do I do this using a Dialog box?
  • SavatageSavatage Member Posts: 7,142
    :?: if they need to enter a field on that form in the first place why not just add that field to the form instead of going somewhere else to enter the info & then trying to transfer it back????

    But any way a dialog box works like this...

    Lets say I have a field on the item card I want to fill using a dialog box
    I create a command Button and add the code

    OnPush()
    CLEAR(MyItemfieldname); 
    Item.GET("No."); 
    Window.OPEN('Enter Text ##############1##',MyItemfieldname); 
    Window.INPUT(1,MyItemfieldname); 
       Item."The Field I Want To Fill" := MyItemFieldName; 
       Item.MODIFY; 
       Window.CLOSE;
    

    Here are some Input Dialog posts - probably more if you search
    http://www.mibuso.com/forum/viewtopic.php?t=10830
    http://www.mibuso.com/forum/viewtopic.php?t=16266
Sign In or Register to comment.