Subform calling main form

sabzamsabzam Member Posts: 1,149
Dear All,

Can a subform in some way or another call the main form?

Comments

  • crisnicolascrisnicolas Member Posts: 177
    sure yo can... just create a variable of type form, pointing the form you want, and call it's functions or run it... but... it will be a different instance of the form...
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    I don't know if your question belongs to NAV Three Tier but take a look at this topic http://www.mibuso.com/forum/viewtopic.php?t=22564.

    Or you could try by SendKeys explained in this topic http://www.mibuso.com/forum/viewtopic.php?p=136085.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • sabzamsabzam Member Posts: 1,149
    That's the issue I need to call the proper form rather than just the form of the main form. Therefore I need something of the sort currform.(subformname).form.(function). This can be used for the main form to call the current subform but I do not know how I could get the same thing the other way round.
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    The only way I know is to use a singleinstance codeunit and RUNMODAL for the form. But in that case you can't use NAV until you closed the form.

    Perhaps you should think about redesign your application.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • pdjpdj Member Posts: 643
    Or you could use the OnTimer trigger on the main form to call a function on the subform every few ms.
    Or move all the code from the form to a single instance codeunit, and use it from both the main-form and sub-form. (But then you should ensure the main form is only open once or be able to support it)

    Depends what you are trying to do...
    Regards
    Peter
  • aseigleaseigle Member Posts: 207
    are you trying to update a header with a value from the line?
  • sabzamsabzam Member Posts: 1,149
    Actually I need to trigger a function onto the main form once a record is modified in the subform.
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    sabzam wrote:
    Actually I need to trigger a function onto the main form once a record is modified in the subform.
    Obviously you're working on classic client, don't you? Then I think you have to redesign your application. A function on a main form that has to be called by a subform isn't a proper application design. And you have to bear in mind that in future (RTC) you won't have any function on GUI.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • David_SingletonDavid_Singleton Member Posts: 5,479
    sabzam wrote:
    Actually I need to trigger a function onto the main form once a record is modified in the subform.

    Move the code to the table in the sub form and have it triggered there.
    David Singleton
  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV Three Tier' forum to 'NAV/Navision Classic Client' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.