Notifications
Clear all

[Closed] Problem Solving for ComboBox and Garbage Collector

Problem Solving with dotNetObject “System.Windows.Forms.ComboBox” for 2009 3dsMax
As is well known “ComboBox” conflicts with 3dsMax Garbage Collector
In 2010 3dsMax and above is solved by using next function:

 AssemblyComboBox = dotNetObject "System.Windows.Forms.ComboBox" 
dotNet.setLifetimeControl AssemblyComboBox # dotnet

For 3dsMax 2009 (and I think this will work and with 3dsMax 9 )
problem can be solved in this way
Protecting the object from garbage collection

 (dotnetclass "System.gc").SuppressFinalize AssemblyComboBox 
(Dotnetclass "System.gc").KeepAlive AssemblyComboBox 

when closing the form allow the garbage collector process combo box

 (dotnetclass "System.gc").ReRegisterForFinalize AssemblyComboBox 
AssemblyComboBox.Dispose() 

.Net System.GC