Solved

vb.net 'Color' is ambiguous in the namespace 'System.Drawing'

Posted on 2014-11-25
2
434 Views
Last Modified: 2016-01-20
I tranasferred my project from VB6 to VB.net, and in one form on the line stating "Me.Frm1.BackColor = System.Drawing.Color.White" I get an error message 'Color' is ambiguous in the namespace 'System.Drawing'.
In another form on the same line, there is no error message. However, I did recognize one difference, that it when I highlight the word "System" it shows up "Namespace System" and when highlighting the word Drawing it shows up "Namespace Drawing".
As opposed to the previous from where the error showed up, when I highlight the word "System" it shows up "... Namespace System.Drawing".

I get these error messages for Point, and Size, and Color and Font.

Why is this happening in one form and not in the other, and how do I get rid of this error message?
0
Comment
Question by:Moshe Singer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 33

Accepted Solution

by:
it_saige earned 500 total points
ID: 40465959
It is happening because the designer has "Imports" to two or more namespaces with the property Color defined and cannot determine which Color you want.  For Example -
Imports EE_Q28569456.Foo
Imports EE_Q28569456.Bar

Module Module1
	Sub Main()
		Dim FooColor As New Drawing() With {.Color = System.Drawing.Color.AliceBlue}
		Dim BarColor As New Drawing() With {.Color = System.Drawing.Color.YellowGreen}
	End Sub
End Module

Namespace Foo
	Public Class Drawing
		Public Property Color() As System.Drawing.Color
	End Class
End Namespace

Namespace Bar
	Public Class Drawing
		Public Property Color() As System.Drawing.Color
	End Class
End Namespace

Open in new window


Shows this in the designer:Capture.JPGAnd this in the Error List:Capture.JPG
But if we explicitly define our declarations:
Imports EE_Q28569456.Foo
Imports EE_Q28569456.Bar

Module Module1
	Sub Main()
		Dim FooColor As New EE_Q28569456.Foo.Drawing() With {.Color = System.Drawing.Color.AliceBlue}
		Dim BarColor As New EE_Q28569456.Bar.Drawing() With {.Color = System.Drawing.Color.YellowGreen}
	End Sub
End Module

Namespace Foo
	Public Class Drawing
		Public Property Color() As System.Drawing.Color
	End Class
End Namespace

Namespace Bar
	Public Class Drawing
		Public Property Color() As System.Drawing.Color
	End Class
End Namespace

Open in new window


Everyone is happy.

However, without seeing more code or getting more information, I could not tell you the specific; explicit definition you would need.

-saige-
1
 

Author Comment

by:Moshe Singer
ID: 41424161
the problem is not a problem
i am trying now there no any problem
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The CRUD Functions CRUD, meaning "Create, Read, Update, Delete (http://en.wikipedia.org/wiki/Create,_read,_update_and_delete)" is a common term to data base developers.  It describes the essential functions of data base table maintenance.  This art…
Introduction This question got me thinking... (http://www.experts-exchange.com/questions/28707487/GLOBALS.html) Why shouldn't we use Globals? This is a simple question without a simple answer.  How do you explain these concepts to a programmer w…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question