Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to select blocks from within VB.NET?

Status
Not open for further replies.

jholweg

Programmer
Nov 14, 2002
1
NL
Hi all,

I'm trying to select blocks in an open drawing from within VB.NET. I use the following code fragment (myAcadDoc refers to the open document):

--------- START CODE FRAGMENT ---------------
Dim gpCode(1) As Integer, dataValue(1) As Object

gpCode(0) = 0 : dataValue(0) = "INSERT"
gpCode(1) = 2 : dataValue(1) = "BlockName"

ssTitleBlock = myAcadDoc.SelectionSets.Add("isAcadBatch")
ssTitleBlock.Select(acSelectionSetAll, , , gpCode, dataValue)
--------- END CODE FRAGMENT ---------------

This causes an exception to be generated. The problem is that the "dataValue" parameter should be of COM-type "vbVariant + vbArray". However, what is the equivalent .Net type??? Please help...

Best regards,

Jaap Holweg
mailto:J.Holweg@infostrait.nl
 
I'm having the same problem as well. I thought VB.NET will automatically wrap the object type to the appropriate datatype for the COM layer, but it's not working. Can you post a solution if you found one?
 
Hey,

I finally got the answer to this one. The group code array needs to be declared an an array of shorts in order for the select statement to accept it on the COM side.

Dim gpCode(1) As Short;

Thanks,
Nutan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top