I beleive you have to access the layers via the layertable object. When you access the record, just like you would access the blocktable, you can pass a name to the program and get back an LayerId. Then you can use that layerID to set a layertablerecord to the specified layer. After that you i believe you can manipulate the object like it was an AcadLayer object.
here is some code from one of the labs in the .Net training.
Private Function CreateLayer() As ObjectId
Dim layerId As ObjectId 'the return value for this function
Dim db As Database = HostApplicationServices.WorkingDatabase
Using trans As Transaction = db.TransactionManager.StartTransaction()
'Get the layer table first, open for read as it may already be there
Dim lt As LayerTable = trans.GetObject(db.LayerTableId, OpenMode.ForRead)
'Check if EmployeeLayer exists...
If lt.Has("EmployeeLayer") Then
layerId = lt.Item("EmployeeLayer")
'If not, create the layer here.
Dim ltr As LayerTableRecord = New LayerTableRecord()
ltr.Name = "EmployeeLayer" ' Set the layer name
ltr.Color = Color.FromColorIndex(ColorMethod.ByAci, 2)
' it doesn't exist so add it, but first upgrade the open to write
layerId = lt.Add(ltr)
Hope that helps. Definitely a lot of code involved to set a layer!
Yeah, i know what you mean. I taught myself to program in VBA and it's really not all that difficult. Now I've joined the .NET world, and i feel like i'm re-learning the basics. But it seems worth it to learn the Managed API's because you can do so much more... Create custom tool palletes, custom tabs in the AutoCAD options menu, and i can use the JIG function..
.NET programs definitely feel more like an extension of AutoCAD than VBA/COM programs do. However it takes about 20 lines of code to do the same thing as 4 lines of code in COM
I'm not quite sure about performance speed. I think that using COM in VB is slightly faster than VBA. And .NET is only slightly slower than ObjectARX
check out this post, there is a graph and some comments. i think the graph is slightly misleading though...