Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

passing values using Args() class

(0) ShareShare
ReportReport
Posted on by


Args.JPG
Hi all ...
I am just trying to send a string from Form1 to Form2 by clicking on button on Form1
after I make some search on the internet, I found this approach that sending and opening the Form2
about me I don't want Form1 open Form2 because Form2 already opened, and I want Form2 receive the value automatically
Help please.

  • 365 financial Profile Picture
    on at
    RE: passing values using Args() class

    thanks a lot..

    it is done

  • Verified answer
    Martin Dráb Profile Picture
    233,066 Most Valuable Professional on at
    RE: passing values using Args() class

    You can use a method and pass the value through a method parameter. For example:

    FormRun callerForm = element.args().caller();
    callerForm.myMethod(strEdt2.text());

  • 365 financial Profile Picture
    on at
    RE: passing values using Args() class

    ok martin now if I get the caller of the parent form how can i pass for example a string value from child form to the parent

    can you give me some lines of code please

  • Martin Dráb Profile Picture
    233,066 Most Valuable Professional on at
    RE: passing values using Args() class

    That sounds easy. You should be able to get a reference to the main form by calling element.args().caller().

  • 365 financial Profile Picture
    on at
    RE: passing values using Args() class

    Ok I have a form with a grid that read a one row of data from a DataSource, in this form there is a button when I press it a new form is opened this form contain:

    1- string edit value that comes from another DataSource

    2- OK button

    So, when I press the OK Button the value in the string edit must be passed to a field in a DataGrid of the main form.

    I hope that is clear

  • Martin Dráb Profile Picture
    233,066 Most Valuable Professional on at
    RE: passing values using Args() class

    Well, how do you intend to determine which form your want to update? I can have multiple instances of Form2 running (or none). And you don't have a reference to any of them.

    Let's let's forget implementation details for now. Instead, tell us what business requirement you're trying to implement.

  • 365 financial Profile Picture
    on at
    RE: passing values using Args() class

    Thank u Girish Your response was helpful

  • 365 financial Profile Picture
    on at
    RE: passing values using Args() class

    thanks Martin for your response and I changed the title of this thread. Yes, the two forms don't relate to each other so what is the design that I should to have?

  • GirishS Profile Picture
    27,825 Moderator on at
    RE: Args() class issue

    In addition to Martin comments, it seems that you are using string control for both the forms, So its not possible to pass value from first form to second form if it is not called from the first form.

    If the string control is table level field you can update the string value entered in form 1 table to form 2 table. But you need to press F5 to see the data in the Form 2.

    Thanks,

    Girish S.

  • Martin Dráb Profile Picture
    233,066 Most Valuable Professional on at
    RE: Args() class issue

    If you Form1 has a reference to the FormRun object of Form2 (e.g. because it was open from Form1), you can simply calls a method of Form2 and pass the value there. If you just have two forms that aren't aware of each other, the task isn't easy and you should rather come with a different design.

    Note that it's not "Args class issue" in either case, therefore you should rather update the title of this thread.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,467 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,066 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans