473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Conflicting namespaces??

I've included both the System.Drawing namespance and the
System.Web.UI.WebControls namespace on my page. Both of
these have an Image class, so when I call the Image class
(refering to the System.Drawing namespace) can I do it
without having to write the entire string?
System.Drawing.Image... I get errors saying Image is
ambiguous otherwise.
Nov 17 '05 #1
2 1827
Hi

Every namespace and type has a fully qualified name,
which uniquely identifies the namespace or type amongst
all others.

So use fully qualified name.

Ravikanth[MVP]

-----Original Message-----
I've included both the System.Drawing namespance and the
System.Web.UI.WebControls namespace on my page. Both of
these have an Image class, so when I call the Image class(refering to the System.Drawing namespace) can I do it
without having to write the entire string?
System.Drawing.Image... I get errors saying Image is
ambiguous otherwise.
.

Nov 17 '05 #2
"Will" <ws*****@comcast.net> wrote in
news:0e****************************@phx.gbl:
I've included both the System.Drawing namespance and the
System.Web.UI.WebControls namespace on my page. Both of
these have an Image class, so when I call the Image class
(refering to the System.Drawing namespace) can I do it
without having to write the entire string?
System.Drawing.Image... I get errors saying Image is
ambiguous otherwise.


Will,

Both VB.Net and C# support namespace aliases. You can use this
mechanism to give different (usually shorter) names to a specified
namespace.

VB.Net:

Imports Draw = System.Drawing
Imports WebUI = System.Web.UI.WebControls

' Create a System.Drawing Image:
Dim MyDrawImage As Draw.Image = Draw.Image.FromFile('myfile.bmp')

' Create a System.Web.UI.WebControls Image:
Dim MyWebImage As New WebUI.Image()

C#:

using Draw = System.Drawing;
using WebUI = System.Web.UI.WebControls;

// Create a System.Drawing Image:
Draw.Image MyDrawImage = Draw.Image.FromFile("myfile.bmp");

// Create a System.Web.UI.WebControls Image:
WebUI.Image MyWebImage = new WebUI.Image();
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Steven Bethard | last post by:
In the "empty classes as c structs?" thread, we've been talking in some detail about my proposed "generic objects" PEP. Based on a number of suggestions, I'm thinking more and more that instead of...
2
by: humble04 | last post by:
Hi, I am compiling a collection of C++ code. Most of them are using the new format #include <iostream>. I think all of them because I failed at finding out which header file uses the old format ...
7
by: Thiru | last post by:
I am writing an application that interacts with Oracle and Teradata. In order to create the executable, I need to link various Oracle and Teradata libraries. I found out that when I link the...
4
by: Alexander Gorshenev | last post by:
I am looking for an elegant solution for the following problem: I have two projects for which I have to create a kind of bridge or translator between. For each of the projects there exist a set...
11
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
11
by: alex sparsky | last post by:
I have a rather unique problem that I need some advice on. I have multiple c# controls that need to make use of a common namespace. So when I go to include both controls that make use of that...
1
by: javatopia | last post by:
Hello! I have a web page named "ChangePassword.aspx", which works just wonderful on my developer machine. When I deploy it to the server, though, I get: Compiler Error Message: CS0030: Cannot...
1
by: helraizer1 | last post by:
Hi folks, I have an image based shoutbox which I am currently implementing emoticons onto. I have a way now for the emoticons to appear where the :D or =) etc. is on the image, but for some reason...
12
by: Michael.Z | last post by:
Anyone who can help: Given a Table.h file I am writing a Table.c file. I keep getting the compile error: previous declaration of Table was here / conflicting types for I think the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.