Color not working anymore after referencing Inventor to vb.net??

Color not working anymore after referencing Inventor to vb.net??

Anonymous
Not applicable
990 Views
7 Replies
Message 1 of 8

Color not working anymore after referencing Inventor to vb.net??

Anonymous
Not applicable

Hi I have a form that I created in vb.net which had no errors untill I refrenced the Inventor "Autodesk.Inventor.Interop.dll" now anything to do with color such as the code bellow has an error stating that "Black is not a member of color"? Thats really anoying dose anybody know how to fix this?

 

  'Numeric value check Angle 2 section...S
        If IsNumeric(DataGridView2.Rows(6).Cells(1).Value) Then
            'Restores font style to proper values if error occoured before...
            DataGridView2.Rows(6).Cells(1).Style.ForeColor = Color.Black
            DataGridView2.Rows(6).Cells(1).Style.BackColor = Color.White
        Else

 

test.png 

0 Likes
Accepted solutions (2)
991 Views
7 Replies
Replies (7)
Message 2 of 8

_Tharwat
Advisor
Advisor

It is better to post the VB codes in its correct forum, so the following link is for VB.net.

http://forums.autodesk.com/t5/visual-basic-customization/bd-p/33

0 Likes
Message 3 of 8

_gile
Consultant
Consultant
Accepted solution

Hi,

 

I don't know the Inventor COM API but it may contain a 'Color' type which should create a conflict with the System.Drawing.Color one.

 

Try using the fully qualified name:

 

DataGridView2.Rows(6).Cells(1).Style.ForeColor = System.Drawing.Color.Black
DataGridView2.Rows(6).Cells(1).Style.BackColor = System.Drawing.Color.White


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 4 of 8

Anonymous
Not applicable

How do I do that otherwise some smartypants will whinge about double posts?

0 Likes
Message 5 of 8

_gile
Consultant
Consultant

IMO you're in the right place as your request is about .NET.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 6 of 8

Anonymous
Not applicable

Fair enougth this works... Why is this happening then? (just trying to gain understanding)

0 Likes
Message 7 of 8

_gile
Consultant
Consultant
Accepted solution

As I said, two different namespaces may contain a type (class) with the same name so, you need to differentiate them using their fully qualified names (or aliases if this exists with VB).



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 8 of 8

Anonymous
Not applicable

makes sense 🙂

0 Likes