Locate intersection between two lines (input via ILocateCommandEvent)

Hi

I am trying to figure out how to locate the intersection between two lines. The two lines are pointed out by the user, via ILocateCommandEvents.

I have created two class modules; LCE_Element1 and LCE_Element2.

As far as I understand, you can treat no more than one element in each class module. This happens in the ILocateCommandEvents_Accept subroutine. This is why I have created two class modules. In LCE_Element1 the first line is given by the user, AND the LCE_Element2 is called, where the second line is set.

My LCE_Element1 looks like this:

Private Sub ILocateCommandEvents_LocateFilter(ByVal Element As Element, Point As Point3d, Accepted As Boolean)
ShowCommand "Intersection"
ShowPrompt "Click again to confirm (1)"
End Sub
Private Sub ILocateCommandEvents_Accept(ByVal Element As Element, Point As Point3d, ByVal View As View)
Dim element1 As Element
Set element1 = Element (the first element is now pointed out by the user)
CommandState.StartLocate New LCE_Intersection_Element2 (the second class module is called, where the user sets the second element)
ShowCommand "Intersection"
ShowPrompt "Select second element"
End Sub

My LCE_Element1 looks like this:

Private Sub ILocateCommandEvents_LocateFilter(ByVal Element As Element, Point As Point3d, Accepted As Boolean)
ShowCommand "Intersection"
ShowPrompt "Click again to confirm (2)"
End Sub
Private Sub ILocateCommandEvents_Accept(ByVal Element As Element, Point As Point3d, ByVal View As View)
Dim element2 As Element
Set element2 = Element
ShowCommand "Intersection"
ShowPrompt "Found"
End Sub

Now, the problem is the scope of the variables element1 and element2. These are the two elements I want to find the intersection between, but I cannot access them at the same time.

I have tried to declare public variables, but when I try to update their value in the class modules, the routines fail to execute.

How can I solve this?

EDIT: It seems like I just had to write "Set" when updating the public variables inside the subroutines. I think there is no problem at all.

Best regards