.NET

.NET

Reply
Contributor
pderuiter77
Posts: 14
Registered: ‎01-09-2013
Message 1 of 8 (295 Views)
Accepted Solution

VB.NET + COM GetEntity gives type mismatch

295 Views, 7 Replies
01-09-2013 04:30 AM

The following code keeps throwing a type mismatch on the GetEntity line

What am i doing wrong?

 

Dim obj As Object = Nothing

Try
    Dim pnt As Object = Nothing
    doc.Utility.GetEntity(obj, pnt, "test")
Catch ex As Exception
    Return False
End Try

The following code as well:

Dim obj as Object = Nothing
Try Dim pnt As Object = Nothing doc.Utility.GetEntity(obj) Catch ex As Exception Return False End Try

 

When i give no parameters i get an error that the number of parameters is not correct. That's fine, but that would imply

- that there is an overload accepting 1 parameter

- that the 'obj' parameter is of the wrong type

I gave up and used early binding instead. That worked

Moderator
Alexander.Rivilis
Posts: 1,458
Registered: ‎04-09-2008
Message 2 of 8 (282 Views)

Re: VB.NET + COM GetEntity gives type mismatch

01-09-2013 05:13 AM in reply to: pderuiter77
Dim obj As Object = Nothing
Dim pnt(2) As Object
Try
    doc.Utility.GetEntity(obj, pnt, "test")
Catch ex As Exception
    Return False
End Try

 ?


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Contributor
pderuiter77
Posts: 14
Registered: ‎01-09-2013
Message 3 of 8 (276 Views)

Re: VB.NET + COM GetEntity gives type mismatch

01-09-2013 05:41 AM in reply to: Alexander.Rivilis

unfortunately no :smileyhappy:

 

I'm running a thread in another forum as well and it seems that autocad not being the top window at the time seems to have an effect on this issue

Moderator
Alexander.Rivilis
Posts: 1,458
Registered: ‎04-09-2008
Message 4 of 8 (271 Views)

Re: VB.NET + COM GetEntity gives type mismatch

01-09-2013 05:56 AM in reply to: pderuiter77

Sorry. What about:

Dim pnt(2) As Double

 ?


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Contributor
pderuiter77
Posts: 14
Registered: ‎01-09-2013
Message 5 of 8 (269 Views)

Re: VB.NET + COM GetEntity gives type mismatch

01-09-2013 06:01 AM in reply to: Alexander.Rivilis

yes i tried that, but it didn't work

 

and about bringing autocad to the front: wrong track. I built in a 500ms delay and the call rejected error disappears and the original error reappears

Contributor
pderuiter77
Posts: 14
Registered: ‎01-09-2013
Message 6 of 8 (252 Views)

Re: VB.NET + COM GetEntity gives type mismatch

01-09-2013 07:44 AM in reply to: pderuiter77

I gave up and used early binding instead. That worked

Valued Mentor
jeff
Posts: 338
Registered: ‎05-12-2009
Message 7 of 8 (236 Views)

Re: VB.NET + COM GetEntity gives type mismatch

01-09-2013 02:10 PM in reply to: pderuiter77

pderuiter77 wrote:

unfortunately no :smileyhappy:

 

I'm running a thread in another forum as well and it seems that autocad not being the top window at the time seems to have an effect on this issue


Are these replies to feedback at another forum?

 

 

 

 

 

You can also find your answers @ TheSwamp
Contributor
pderuiter77
Posts: 14
Registered: ‎01-09-2013
Message 8 of 8 (224 Views)

Re: VB.NET + COM GetEntity gives type mismatch

01-09-2013 11:28 PM in reply to: pderuiter77

No,

 

i was referencing some findings in the other thread which at first glance seemed to have relevance.

 

i didn't want to cross post, but the gentleman in the other thread recommended this group so i posted here, but since he kept helping i didn't want to abandon that thread

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.