web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

X++ Run Method vs Main Method

(0) ShareShare
ReportReport
Posted on by

Hi Guys,

I wanna to know The role of Run() and Main method in X++

Thanks in advance,

Riyaz

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at

    in majority of oop based programming langauges its needs only one of two things in order to run a class

    1) create an object of class and use it to call any of its methods

    OR

    2) create a main method in the class and just run the class. the class will get a entry point itself by main method

    if you remember java

    public static void main(String[] args)

    if you remember c++

    #include<iostream>

    using namespace std;

    int main()

    {

    cout << "Hello World!";

    return 0;

    }

    okay now run method

    It is common to call methods within one class from other methods in that class.

    in such cases a run method is written in class and by using approach#1 i.e creating object of class we just call run method of class and remaining it handles

  • Suggested answer
    Martin Dráb Profile Picture
    239,932 Most Valuable Professional on at

    Only main() method has a special meaning - it's can be called from menu items. Run() method is just a method as any other.

    Of course, there are important classes that have a method called run() (such as the RunBase framework), but you would have to tell which class you have in mind.

  • bilal170795 Profile Picture
    185 on at

    What is the role of Run() method in Form?

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    It will "execute" / open the form. If it's not called, the form is not opened.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans