Cannot Access A Disposed Object

Cannot Access A Disposed Object

MechMachineMan
Advisor Advisor
431 Views
0 Replies
Message 1 of 1

Cannot Access A Disposed Object

MechMachineMan
Advisor
Advisor

I have created a form in visual studio which I plan to implement in a rule to make things look nicer.

 

However, when I x out of the Form, and then try to run the rule again, it gives me an error about it being disposed.

 

Cannot access a disposed object.
Object name: 'SectionSymToolBox'.

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'SectionSymToolBox'.
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at SectionSymRule.LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

How do i fix this?

 

 

Rule: 

AddReference "C:\Users\Documents\Visual Studio 2013\Projects\WindowsApplication1\WindowsApplication1\bin\Release\SectionSymToolBox.dll" 

Public Class SectionSymRule

	Public Shared ToolBox As New SectionSymToolBox.SectionSymToolBox

	Sub Main()
		AddHandler ToolBox.Button1.Click, AddressOf SwapSymbols
		AddHandler ToolBox.Button2.Click, AddressOf SwapSymbols
		AddHandler ToolBox.Button3.Click, AddressOf SwapSymbols
		AddHandler ToolBox.Button4.Click, AddressOf SwapSymbols
		AddHandler ToolBox.Button5.Click, AddressOf SwapSymbols
	

	
	ToolBox.Show()
	
	End Sub
	
	Sub SwapSymbols()
		MsgBox("Here!")
	End Sub

End Class

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
432 Views
0 Replies
Replies (0)