on 10-19-2007 9:43 AM
Is it recommended to dispose the UI objects like this? Is there a check by sap on the refcount of the ui com objects?
System.Runtime.InteropServices.Marshal.ReleaseComObject( m_menu );
I know it is strongly recommended for DI objects and had already some trouble with it. Strange enough none of the sample code releases the objects witch is wrong in my opinion!
What is yours expirience with the UI objects? Do i have to dispose the after use?
Why should you dispose explicitily UI objects ? .NET garbage collection should
do it for you ....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you add a user fields with UserFieldMD and do not release the object explicit you get the error refcount not zero.
The objects self checks if an other object already exists to to avoid conflicts. You also dont know when the garbage collector will destroy the first object. So running the code again before the GC has run throws an error.
Thats why I whant to know if this is also the case for UI objects.
Hi Maarten,
It really depends on how you've designed your program. Every time a form is closed I have code which explicity destroys the form object and calls the garbage collector. This way I know the memory is more or less immediately released when the form is closed. But as I mentioned before, it depends on how you've structured your program and if you want to be in control of freeing memory etc...
Lita
Hi Maarten Jardin ,
I think we need not want to destroy UI Components. In fact better avoid.
When we create a DI object lets say a company object a new object will be loaded into the memory of your add-on and only your add can able to access these objects.
Where as in UI we are not creating any UI component. We are manipulating with SBO UI API to load components. You are just referring to the UI components loaded by SAP Business One.
When we see this in depth, lets assume we are creating an add-on that loads UI and DI object. After you close your add on still you form will be live inside SAP Business One. Now you access these form using addition add-on and manipulate with it.
Any thoughts by others?
Regards
B.Ravi Shankar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
11 | |
11 | |
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.