Converting Block statements form VB.net to C sharp.

Converting Block statements form VB.net to C sharp.

muckmailer
Collaborator Collaborator
436 Views
1 Reply
Message 1 of 2

Converting Block statements form VB.net to C sharp.

muckmailer
Collaborator
Collaborator

What is the C sharp equivalent for the 3 statements.

 

Dim bt As BlockTable = db.BlockTableId.GetObject(OpenMode.ForRead)
Dim btr1 As BlockTableRecord = bt(Me.TextBox4.Text).GetObject(OpenMode.ForRead)
Dim objIdColl As ObjectIdCollection = btr1.GetBlockReferenceIds(True, True)

 

Me.TextBox4.Text is a string which is a block name.

 

 

Thank you,

 

0 Likes
437 Views
1 Reply
Reply (1)
Message 2 of 2

_gile
Consultant
Consultant

@muckmailer wrote:

What is the C sharp equivalent for the 3 statements.

 

Dim bt As BlockTable = db.BlockTableId.GetObject(OpenMode.ForRead)
Dim btr1 As BlockTableRecord = bt(Me.TextBox4.Text).GetObject(OpenMode.ForRead)
Dim objIdColl As ObjectIdCollection = btr1.GetBlockReferenceIds(True, True)

 

Me.TextBox4.Text is a string which is a block name.

 

 

Thank you,

 


Nearly the same...

 

BlockTable bt = db.BlockTableId.GetObject(OpenMode.ForRead);
BlockTableRecord btr1 = bt[this.TextBox4.Text].GetObject(OpenMode.ForRead);
ObjectIdCollection objIdColl = btr1.GetBlockReferenceIds(true, true);


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes