Hello,
I am trying to get the vendor items lookup form to open up in GP from a custom form built in Visual Studio with the Dynamics GP Addin Project.
I am currently running into a problem where once it hits the open line of the form, it just closes right away and doesn't do anything else to it from the code. I have tried many things but can't quite figure it out. I am wondering if anyone has gotten this to work within visual studio.
My code is below for the lookup. It might not all be right.
Thanks,
//show the vendor item lookup form
PopVendorItemsForm popVendorItemsForm = SmartList.Forms.PopVendorItems;
// PopVendorItemsForm.PopVendorItemsWindow popVendorItemsWindow = popVendorItemsForm.PopVendorItems.IvItemVendorLookup..PopVendorItems;
popVendorItemsForm.Open();
popVendorItemsForm.PopVendorItems.LocalVendorSortBy.Value = 1;
popVendorItemsForm.PopVendorItems.IvItemVendorLookup.SortBy.Value = 1;
popVendorItemsForm.PopVendorItems.IvItemVendorLookup.RunValidate();
popVendorItemsForm.PopVendorItems.LocalVendorSortBy.RunValidate();
//Set the ReturnToLookup flag to true so we know we called the lookup window.
GPAddIn.ReturnToVendorItemLookup = true;
*This post is locked for comments
You can see on the bottom bar, its slightly open, that is after its closed after being opened for a split second.
Mariano,
Thanks for the quick response. However, it did not solve the problem. So what happens when I debug the code, it will hit the popVendorItems.Open() line and as soon as it does it, it opens the form in GP and then right away closes it again. Its like there is another event that is fired off that is closing the form as soon as it opens. SO when I click my lookup button on my form without debugging, the vendor items form flashes on my screen for about 100 ms.
Have you ever run into that before on other lookups?
Thanks,
Seth
Try this:
PopVendorItemsForm popVendorItems = Dynamics.Forms.PopVendorItems; if (popVendorItems.IsOpen == false) { popVendorItems.Open(); } popVendorItems.PopVendorItems.IvItemVendorLookup.SortBy.Value = 1; popVendorItems.PopVendorItems.LocalVendorSortBy.Value = 1; popVendorItems.PopVendorItems.IvItemVendorLookup.VendorId.Value = ""; popVendorItems.PopVendorItems.IvItemVendorLookup.VendorItemNumber.Value = ""; popVendorItems.PopVendorItems.IvItemVendorLookup.ItemNumber.Value = ""; popVendorItems.PopVendorItems.IvItemVendorLookup.VendorItemDescription.Value = ""; popVendorItems.PopVendorItems.IvItemVendorLookup.Return.Value = 1; popVendorItems.PopVendorItems.LocalVendorSortBy.RunValidate();
There are techniques to capture the value being returned from a Dex lookup window to a Visual Studio Tools WinForm field, but let's make sure the above works first.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156