I have a short bit of code that gets a selection from the current document and filters for a block reference.
That in itself is unremarkable, however, what is happening is that after selection, if the user opens TEXTSCR, the window is inaccessible as though it is not the topmost window. Trying to click in the window produces the Default Beep.
I've commented out the actual selection portion of the code and have verified that is where the problem starts.
The code is question:
Using doc.LockDocument()
Using acTrans As Transaction = db.TransactionManager.StartTransaction
While _currentBlockReference Is Nothing
'Removing the next line stops the issue
Dim SSet As PromptSelectionResult = ed.GetSelection(pso, IntvolFilter)
If (SSet.Status = PromptStatus.OK) Then
For Each selObj As SelectedObject In SSet.Value
Dim sent As Entity = DirectCast(acTrans.GetObject(selObj.ObjectId, OpenMode.ForRead), Entity)
If TypeOf sent Is BlockReference Then
_currentBlockReference = DirectCast(sent, BlockReference)
End If
Next
ElseIf (SSet.Status = PromptStatus.Error) Then
ed.WriteMessage(vbCrLf & My.Resources._MustBeIntersection)
ElseIf (SSet.Status <> PromptStatus.OK) Then
Exit While
End If
End While
If _currentBlockReference Is Nothing = False Then
Me.txtCurrent.Text = GetDataFromIntVol(_currentBlockReference, acTrans)
Me.txtProposed.Text = GetDataFromIntVol(_currentBlockReference, acTrans, cbxConvertTo.SelectedIndex)
End If
acTrans.Commit()
End Using
End Using
Obviously I can't just remove one line, but I have edited the code slightly to prevent the selection and it doesn't have the issue. Perhaps it is something simple, but I just don't see it.