.NET

.NET

Reply
Contributor
14 Posts
0 Kudos
Registered: ‎01-09-2013
Post 1 of 8
Accepted Solution

VB.NET + COM GetEntity gives type mismatch

299 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
1,467 Posts
277 Kudos
Registered: ‎04-09-2008
Post 2 of 8

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
14 Posts
0 Kudos
Registered: ‎01-09-2013
Post 3 of 8

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
1,467 Posts
277 Kudos
Registered: ‎04-09-2008
Post 4 of 8

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
14 Posts
0 Kudos
Registered: ‎01-09-2013
Post 5 of 8

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
14 Posts
0 Kudos
Registered: ‎01-09-2013
Post 6 of 8

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
341 Posts
53 Kudos
Registered: ‎05-12-2009
Post 7 of 8

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
14 Posts
0 Kudos
Registered: ‎01-09-2013
Post 8 of 8

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
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!