Thanks for replay
function gettoplevelblocks is declared in provided code :
Function GetTopLevelBlocks(ByVal DatabaseIn As Database) As List(Of String)
Dim myList As New List(Of String)
Using myTrans As Transaction = DatabaseIn.TransactionManager.StartTransaction
Dim myBT As BlockTable = DatabaseIn.BlockTableId.GetObject(OpenMode.ForRead)
For Each myBTRid As ObjectId In myBT
Dim myBTR As BlockTableRecord = myBTRid.GetObject(OpenMode.ForRead)
If myBTR.IsAnonymous = False And myBTR.IsLayout = False And _
myBTR.IsFromExternalReference = False And _
myBTR.IsDependent = False Then
myList.Add(myBTR.Name)
End If
Next
End Using
Return myList
End Function
The code provided i previos post is from may form code, I also have class.vb wich start form and code for it is :
Public Class Class1
Public ReadOnly Property ThisDrawing() As AcadDocument
Get
Return Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.AcadDocument
End Get
End Property
<CommandMethod("chxr")> _
Public Sub Blok()
Dim myForm As New Form1
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(myForm)
End Sub
Problem is that I always get Fatal error in autocad saying:
FATAL ERROR: Unhandled Access Violation Reading 0x0000 Exception at 3e49e059h