473,729 Members | 2,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2931

"Fred Nelson" <fr**@smartybir d.com> wrote in message
news:ex******** ******@tk2msftn gp13.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.W ebControls.Imag e 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**@smartybir d.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.M obileControls;
using System.Web.UI.W ebControls;

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

--
Jon Skeet - <sk***@pobox.co m>
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**@sma rtybird.com]
Poslano: 30. maj 2005 2:43
Objavljeno v: microsoft.publi c.dotnet.langua ges.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**@smartybir d.com> wrote in message
news:ex******** ******@tk2msftn gp13.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.W ebControls I
have solved the problem as that namespace and System.Drawing both have Image
defined.

Thanks very much!

Fred
"Peter van der Goes" <p_**********@t oadstool.u> wrote in message
news:eh******** ******@TK2MSFTN GP15.phx.gbl...

"Fred Nelson" <fr**@smartybir d.com> wrote in message
news:ex******** ******@tk2msftn gp13.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.W ebControls.Imag e 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.W ebControls 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.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Fred Nelson <fr**@smartybir d.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.M obileControls;
using System.Web.UI.W ebControls;

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

--
Jon Skeet - <sk***@pobox.co m>
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.W ebControls I
have solved the problem as that namespace and System.Drawing both have Image
defined.

Thanks for your help!

"Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message
news:ut******** ******@TK2MSFTN GP09.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**@smartybir d.com> wrote in message
news:ex******** ******@tk2msftn gp13.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.W ebControls.

Thanks Fred
"Saso Zagoranski" <sa************ *@guest.arnes.s i> 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**@sma rtybird.com]
Poslano: 30. maj 2005 2:43
Objavljeno v: microsoft.publi c.dotnet.langua ges.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.W ebControls I
have solved the problem as that namespace and System.Drawing both have Image
defined.

Thanks very much!

Fred
"Peter van der Goes" <p_**********@t oadstool.u> wrote in message
news:eh******** ******@TK2MSFTN GP15.phx.gbl...
"Fred Nelson" <fr**@smartybir d.com> wrote in message
news:ex****** ********@tk2msf tngp13.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.Drawi ng.Image and haven't had any luck!!!

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

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.Drawin g.Image myImage;

System.Web.UI .WebControls.Im age 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

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

Similar topics

9
2607
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 system.drawing.dll Additional information: Overflow or underflow in the arithmetic operation.
3
1331
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 project, or is it better to continue with the py tutes? Also if I was to start, how do I pose myself the question of what am I actually trying to achieve / what am I trying to make? any comments and suggestions welcome.
0
1834
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 stable release and once activated it requested access to the net. Without access it would come up with recognition and 'localhost' connection errors? Can anyone please tell me:
1
6220
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 the text, but never on the same level. Question: how can i get the image and the text on the same level?? Question 2:
4
1280
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 trips" to the browser or am I accessing one instance. If five round trips occur then I will develop some parsing algorithm to save everything I need in one cookie.
2
4156
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 converted an app to VS2005 and this still worked. In VS2005 I can't do this. I have examined the code for VS2003 and I see that there is a style="Z-INDEX... " in the asp code for the
2
3708
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 string. The vb example outputs "A94A8FE5CCB19BA61C4C0873D391E987982FBBD3" The cs example outputs "5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8" for the string "password" Question: do the 2 applications use different automatic "salts" or "seeds" to...
10
11515
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 script? files=glob.glob('*.py') print files Traceback (most recent call last):
1
3998
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 like my text to start at the top right and wrap around the image. However, if there is a long word in my text (which is longer than the available space between the image and the left edge of the component) the the image overlaps the text. Ideally...
0
8761
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.