.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RemoveHandler doesn't remove the event

1 REPLY 1
Reply
Message 1 of 2
pieter_souvereyns
460 Views, 1 Reply

RemoveHandler doesn't remove the event

I want to connect some object (connection: endpoijt is the next beginpoint and elevation the same)

So for these object i created a reactorroutine "acPipeMod"

AddHandler oPipe.Modified, AddressOf acPipeMod

Together with commandended
Dim d As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument()
AddHandler d.CommandEnded, AddressOf CommandEnded

So when the object are moved they are put in a collection and after the command, the fixing begins.

Public Shared Handler_objIds As ObjectIdCollection = New ObjectIdCollection

Public Sub acPipeMod(ByVal senderObj As Object, _
ByVal evtArgs As EventArgs)
Dim opipe As Pipe = senderObj
Handler_objIds.Add(opipe.ObjectId)
End Sub

But before starting I must stop the reactor, so that I don't have a loop.
oPipe = trans.GetObject(pipeid, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite)
If oPipe.IsWriteEnabled = False Then
oPipe.UpgradeOpen()
End If
RemoveHandler oPipe.Modified, AddressOf acPipeMod


But this part, I can't get wrigth, the reactor stays active.
Is there an other step that I must do, to stop the reactor.
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: pieter_souvereyns

Not sure what release of AutoCAD you're using, but if it's 2010 or later,

you would be much better off using Overrules for this type of problem.

 

I can't tell you much about why your handler isn't removed without

doing testing.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost