Not able to remove eventhandler

Not able to remove eventhandler

Anonymous
Not applicable
450 Views
2 Replies
Message 1 of 3

Not able to remove eventhandler

Anonymous
Not applicable

I am using below eventhandler to add e.selectionadded event

 

 

 

AddHandler ed.SelectionAdded, AddressOf testit

 

 

And I am using below statement to remove it.

 

 

RemoveHandler ed.SelectionAdded, AddressOf testit

 

 

 

But it does not get removed.

 

My testit function,

 

 

Public viewmodel As New GetATT_ViewModel
 Public Sub testit(sender As Object, e As SelectionAddedEventArgs)
        Dim objectid() As ObjectId = e.AddedObjects.GetObjectIds

        viewmodel.getattribute(objectid)


    End Sub

 

I read somewhere that you need to make function shared but I can not make that as I am calling another function in it which is not shared.

 

 

0 Likes
451 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant

I don't understand why you are handling SelectionAdded event if you just need to get the selected objects.

Why don't you complete the selection and then pass the selected objects to your viewmodel.getattribute() method ?



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 3

Anonymous
Not applicable

@_gile If you are talking about select object then user hits button to get information of that object, It will be manual right? Its like addign another step.

 

I wanted whenever user selects block, palete displayes its attributes, thats why I aded ed.selectionadded event handler

 

 

I hope it clarifies 

 

Thanks,

Pankaj 

0 Likes