Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

what's GP main window loaded event in toolkit c#?

Posted on by Microsoft Employee

what's GP main window loaded event?

I'd like get company ID after GP loaded, but got nothing from Initialize() function.

*This post is locked for comments

  • Suggested answer
    Andrew John Dean Profile Picture
    Andrew John Dean 1,337 on at
    RE: what's GP main window loaded event in toolkit c#?

    I that case, you can check for when the ToolBar window has been Opened, which occurs after logging in.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: what's GP main window loaded event in toolkit c#?

    I think this will work in 99%. If I saved my user name and company name, I will be automatically logged in without clicking OK button.

  • Verified answer
    Andrew John Dean Profile Picture
    Andrew John Dean 1,337 on at
    RE: what's GP main window loaded event in toolkit c#?

    Here is the code I use to read the CompanyId. The ComapnyId global variable is only populated once the user has selected the company they wish to use. You therefore have to read the value after the OK button is pressed on the Company Switch window.

    static SwitchCompanyForm switchCompanyForm = Dynamics.Forms.SwitchCompany;

    public void Initialize()

    {

      switchCompanyForm.SwitchCompany.OkButton.ClickAfterOriginal += new EventHandler(OkButton_ClickAfterOriginal);

    }

    static void OkButton_ClickAfterOriginal(object sender, EventArgs e)

    {

      int companyID = (int)Dynamics.Globals.CompanyId.Value;

    }

    Hope this helps

    Andrew Dean

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans