Today I was asked an interesting question by a colleague. If a form is opened from an other form, can we make Axapta (3.0) close the called form automatically when closing the caller form. I remembered some old code for making a form truly modal in Axapta, and thought that maybe we could use some of that. Now the solution presented here, is only good for one called form. but it should be quite easy to implement, that all opened forms open from a parent form, are closed when the parent form is closed, by changing the hwndchild reference to a list or a set of HWND-references, looping through that set or list, checking if each HWND-reference refers to an active window, and then and destroying each window. A small example code project can be downloaded here The project contains two small forms and a display menu item. The parent form test, has a buttongroup where the menuitem (referring to the child form testchild) is included. When you open form test, and click the button, testchild open...
My thoughts on Dynamics AX application development. I have been working as a consultant with Microsoft ERP-technology since 1994. Currently I work at Optimate A/S. My main focus is customization and application development. This blog is merely my place to put stuff that I want to remember. If anybody can benefit from reading this, that's great :0). Feel free to use any code snippets posted - but accept that you do this at your own risk!!!