Option strict *is* off... Directcast is something I know NOTHING about, anyway. I got that from somebody's example or a conversion from C#.
I am hating .Net more and more. I used to love programming. Since .Net it has been headache after headache.
Here is the sub I am calling from (a button click - the BIC is a class that includes my block handling routines):
Private Sub cmdInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdInsert.Click
'Dim InsStatus As Integer
Me.Hide()
Dim pPtRes As PromptPointResult
Dim pPtOpts As PromptPointOptions = New PromptPointOptions("")
Dim DWGname As String
Dim InsSpace As String = "Model"
Dim eXplode As Boolean = False
Dim InsLayer As String = "Misc"
Dim strTemp As String
Dim acDoc As Document = AcApp.DocumentManager.MdiActiveDocument
CurDWG = TreeView1.SelectedNode.Tag
DWGname = IO.Path.GetFileNameWithoutExtension(CurDWG)
If My.Computer.Keyboard.ShiftKeyDown Then
OpenFile(CurDWG, False)
Else
If VBStr.Right(DWGname, 3) = "-ps" Then
'DWGname = VBStr.Left(DWGname, Len(DWGname) - 3)
InsSpace = "Paper"
InsLayer = "Misc"
Else
' Determine Layer, Space, and eXplode
strTemp = VBStr.Left(VBStr.Right(DWGname, 6), 5)
If VBStr.Right(DWGname, 1) = "L" And IsNumeric(strTemp) Then
eXplode = True
End If
InsSpace = "Model"
InsLayer = "Misc"
strTemp = VBStr.Left(VBStr.Right(DWGname, 6), 5)
End If
ChangeSpace(InsSpace)
'Insert the drawing as a block
'' Prompt for the start point
pPtOpts.Message = vbLf & "Click where you wish to insert the block reference: "
pPtRes = CurDoc.Editor.GetPoint(pPtOpts)
Dim ptIns As Point3d = pPtRes.Value
'' Exit if the user presses ESC or cancels the command
If pPtRes.Status = PromptStatus.Cancel Then Exit Sub
LYR.SetLayerCurrent(InsLayer)
BIC.InsertDrawingAsBlock(CurDoc, CurDWG, DWGname, ptIns, InsSpace, InsLayer, eXplode)
End If
Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt()
End Sub