473,386 Members | 1,958 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,386 software developers and data experts.

C# Newby Image Question

Hi:

I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a "newby"
question:

In VB.NET I have several routines that upload and process images. I can't
get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY
apprecaited!

Thanks,

Fred
Nov 17 '05 #1
10 2903

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:ex**************@tk2msftngp13.phx.gbl...
Hi:

I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a "newby"
question:

In VB.NET I have several routines that upload and process images. I can't
get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY
apprecaited!

Thanks,

Fred

What type of application? When I try "Image myImage;" in a windows forms
app, I get no compiler error, but when I try to create an actual object with
"Image myImage = new Image();", I get "Cannot create an instance of the
abstract class System.Drawing.Image.". In this context, I'd need to
instantiate a subclass of Image, either Bitmap or Metafile.
I got your error message in a test web app, because there is an Image class
in each of the following places:
System.Drawing.Image myImage;

System.Web.UI.WebControls.Image myImage2;

Therefore, you have to specify which you want.
--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Nov 17 '05 #2
Fred Nelson <fr**@smartybird.com> wrote:
I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a "newby"
question:

In VB.NET I have several routines that upload and process images. I can't
get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY
apprecaited!


My guess is that you've got at least two of:

using System.Drawing;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;

at the top of your class. You should almost certainly only be using one
of those namespaces.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #3
Can you copy/paste your using directives? So we can see, which
namespaces are you using...

-----Izvirno sporočilo-----
Od: Fred Nelson [mailto:fr**@smartybird.com]
Poslano: 30. maj 2005 2:43
Objavljeno v: microsoft.public.dotnet.languages.csharp
Pogovor: C# Newby Image Question
Zadeva: C# Newby Image Question

Hi:

I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a
"newby"
question:

In VB.NET I have several routines that upload and process images. I
can't
get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY
apprecaited!

Thanks,

Fred
Nov 17 '05 #4
Have you created your own class called Image?

Aside from Jon Skeet's advice if you want to have several of the namespaces
included all you need to do is to fully qualify the declaration of myImage
such as:

System.Drawing.Image myImage;

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:ex**************@tk2msftngp13.phx.gbl...
Hi:

I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a "newby"
question:

In VB.NET I have several routines that upload and process images. I can't
get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY
apprecaited!

Thanks,

Fred

Nov 17 '05 #5
Peter:

Thanks for your help! The app I'm working on is a C# web application.

It appears that by removing the reference to System.Web.UI.WebControls I
have solved the problem as that namespace and System.Drawing both have Image
defined.

Thanks very much!

Fred
"Peter van der Goes" <p_**********@toadstool.u> wrote in message
news:eh**************@TK2MSFTNGP15.phx.gbl...

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:ex**************@tk2msftngp13.phx.gbl...
Hi:

I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a "newby" question:

In VB.NET I have several routines that upload and process images. I can't get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY
apprecaited!

Thanks,

Fred

What type of application? When I try "Image myImage;" in a windows forms
app, I get no compiler error, but when I try to create an actual object

with "Image myImage = new Image();", I get "Cannot create an instance of the
abstract class System.Drawing.Image.". In this context, I'd need to
instantiate a subclass of Image, either Bitmap or Metafile.
I got your error message in a test web app, because there is an Image class in each of the following places:
System.Drawing.Image myImage;

System.Web.UI.WebControls.Image myImage2;

Therefore, you have to specify which you want.
--
Peter [MVP Visual Developer]
Jack of all trades, master of none.

Nov 17 '05 #6
Jon:

EXACTLY correct:

It appears that by removing the reference to System.Web.UI.WebControls I
have solved the problem as that namespace and System.Drawing both have Image
defined.

Thanks for your help!

Fred
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Fred Nelson <fr**@smartybird.com> wrote:
I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a "newby" question:

In VB.NET I have several routines that upload and process images. I can't get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY
apprecaited!


My guess is that you've got at least two of:

using System.Drawing;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;

at the top of your class. You should almost certainly only be using one
of those namespaces.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 17 '05 #7
Bob:

It appears that by removing the reference to System.Web.UI.WebControls I
have solved the problem as that namespace and System.Drawing both have Image
defined.

Thanks for your help!

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
Have you created your own class called Image?

Aside from Jon Skeet's advice if you want to have several of the namespaces included all you need to do is to fully qualify the declaration of myImage
such as:

System.Drawing.Image myImage;

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:ex**************@tk2msftngp13.phx.gbl...
Hi:

I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a "newby" question:

In VB.NET I have several routines that upload and process images. I can't get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY
apprecaited!

Thanks,

Fred


Nov 17 '05 #8
Saso:

I was using the default directives inserted in a new web page. The conflict
was with System.Drawing and System.Web.UI.WebControls.

Thanks Fred
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:d7**********@planja.arnes.si...
Can you copy/paste your using directives? So we can see, which
namespaces are you using...

-----Izvirno sporočilo-----
Od: Fred Nelson [mailto:fr**@smartybird.com]
Poslano: 30. maj 2005 2:43
Objavljeno v: microsoft.public.dotnet.languages.csharp
Pogovor: C# Newby Image Question
Zadeva: C# Newby Image Question

Hi:

I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a
"newby"
question:

In VB.NET I have several routines that upload and process images. I
can't
get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY
apprecaited!

Thanks,

Fred

Nov 17 '05 #9
Fred Nelson wrote:
Peter:

Thanks for your help! The app I'm working on is a C# web application.

It appears that by removing the reference to System.Web.UI.WebControls I
have solved the problem as that namespace and System.Drawing both have Image
defined.

Thanks very much!

Fred
"Peter van der Goes" <p_**********@toadstool.u> wrote in message
news:eh**************@TK2MSFTNGP15.phx.gbl...
"Fred Nelson" <fr**@smartybird.com> wrote in message
news:ex**************@tk2msftngp13.phx.gbl...
Hi:

I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a
"newby"
question:

In VB.NET I have several routines that upload and process images. I
can't
get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY
apprecaited!

Thanks,

Fred


What type of application? When I try "Image myImage;" in a windows forms
app, I get no compiler error, but when I try to create an actual object


with
"Image myImage = new Image();", I get "Cannot create an instance of the
abstract class System.Drawing.Image.". In this context, I'd need to
instantiate a subclass of Image, either Bitmap or Metafile.
I got your error message in a test web app, because there is an Image


class
in each of the following places:
System.Drawing.Image myImage;

System.Web.UI.WebControls.Image myImage2;

Therefore, you have to specify which you want.
--
Peter [MVP Visual Developer]
Jack of all trades, master of none.



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 17 '05 #10
You can always use full names:
System.Drawing.Image
or
System.Web.UI.WebControls.Image

you could also do this:
using System.Drawing;
using WebControls = System.Web.UI.WebControls;

and use WebControls.Image

just a thought... :)

-----Izvirno sporočilo-----
Od: Fred Nelson [mailto:fr**@smartybird.com]
Poslano: 30. maj 2005 20:42
Objavljeno v: microsoft.public.dotnet.languages.csharp
Pogovor: C# Newby Image Question
Zadeva: Re: C# Newby Image Question

Bob:

It appears that by removing the reference to System.Web.UI.WebControls I
have solved the problem as that namespace and System.Drawing both have
Image
defined.

Thanks for your help!

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
Have you created your own class called Image?

Aside from Jon Skeet's advice if you want to have several of the namespaces included all you need to do is to fully qualify the declaration of myImage such as:

System.Drawing.Image myImage;

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:ex**************@tk2msftngp13.phx.gbl...
Hi:

I have programmed in VB.NET for about a year and I'm in the process of learing C#. I'm really stuck on this question - and I know it's a "newby" question:

In VB.NET I have several routines that upload and process images. I can't get past "square one" with images in C#:

This statement:

Image myImage;

results in an "ambigous reference" error.

I've searched MSDN and Google and I'm confused - I've tried
System.Drawing.Image and haven't had any luck!!!

I must have a namespace issue or something - any help would be GREATLY apprecaited!

Thanks,

Fred


Nov 17 '05 #11

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

Similar topics

9
by: Damien | last post by:
I have just built a simple stopwatch application, but when i f5 to get things goings i get this message, An unhandled exception of type 'System.ArithmeticException' occurred in...
3
by: dit | last post by:
I want to start something small, like a learning program. I've been looking and learning python for about 4 months; and I think that I have the basics under my belt... is it worth trying my own...
0
by: Pete | last post by:
Hi All, A total Newby with, possibly, a daft question? However, until I can get a reasonable explanation I am disinclined towards going further. Here goes: I recently downloaded the latest...
1
by: Hugo de Payns | last post by:
Happy newyear first of all; I am experimenting with a list and some images; the problem is text and the (LI)image are never outlined, or the image is higher than the text, or the image is below...
4
by: Fred Nelson | last post by:
Hi: I'm developing a web application that needs to have five values, each retrieved from cookies on many pages. If I have five "Request.Cookies" commands together does this cause five "round...
2
by: Fred Nelson | last post by:
Hi: I'm working on a VS2005 web application and I have what is probabably a "newby" question. In VS2003 I could drag a textbox/button/etc on to a form and position it with the mouse. I...
2
by: johnnyG | last post by:
Greetings, I'm studying for the 70-330 Exam using the MS Press book by Tony Northrup and there are 2 side-by-side examples of using the SHA1CryptoServiceProvider to create a hash value from a...
10
by: Charles Russell | last post by:
Why does this work from the python prompt, but fail from a script? How does one make it work from a script? #! /usr/bin/python import glob # following line works from python prompt; why not in...
1
by: laura.paterson | last post by:
Hi, I'm new to html, and having difficulty getting my text to wrap around an image the way I'd like it to.. I have an image in the top left corner of a component, and if there is space, I'd...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.