Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / November 2006

Tip: Looking for answers? Try searching our database.

int data type compatibility

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phuff - 09 Nov 2006 16:11 GMT
I'm hoping someone has some suggestions.  I'm programming something
which interacts with Autodesk Inventor release 11 SP2.  I want to for
loop through a collection and get data fro each item.  Although the
collection specifies [int index] it does not seem to be compatible with
.Net's version of int.

for (inti = 0; i < var.DrawingViews.Count; i++)
{
       MessageBox.Show(var.DrawingViews[i].Name);
}

This always returns an invalid parameter exception.
However, this works:

for (inti = 0; i < var.DrawingViews.Count; i++)
{
       MessageBox.Show(var.DrawingViews[8].Name);
}

As you can see if you hard code the number it gets cast or converted,
COM side, to whatever data type Inventor wants.  I've tried everything.
Int16-64, short-long, and all the unsigned variants.  None of them
work.  I am aware that I can enumerate through the collection with
foreach and it does in fact work.  However, there will undoubtedly be a
point where I will want a dynamic index variable.

Any suggestions?  Any type of Win32 type I should marshal in and cast
this int as?

Thanks!
Phuff - 09 Nov 2006 16:18 GMT
for (inti...   is actually  for (int i... in the code

thought I would specify before someone tried to correct that.

> I'm hoping someone has some suggestions.  I'm programming something
> which interacts with Autodesk Inventor release 11 SP2.  I want to for
[quoted text clipped - 26 lines]
>
> Thanks!
Phuff - 09 Nov 2006 19:21 GMT
OKay, I got it figured out.  Apparently Autodesk uses 1 based
collections, not 0 based.  How annoying.

for (int i = 1; i <= var.DrawingViews.Count; i++)...

> I'm hoping someone has some suggestions.  I'm programming something
> which interacts with Autodesk Inventor release 11 SP2.  I want to for
[quoted text clipped - 26 lines]
>
> Thanks!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.