Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am trying to use Bitmap but I get instant error

trying
using System.Drawing.Bitmap

and keep getting
Error CS0246 The type or namespace name 'Bitmap' could not be found (are you missing a using directive or an assembly reference?) BitMap D:\Data\3M Machines\My Machines\Programmation Project\C#\BitMap\BitMap\Program.cs 13 Active

What I have tried:

Not much, I don't understand what to do.
Posted
Updated 24-Nov-16 5:35am

You only include the namespace in the "using", not the class name

C#
using System.Drawing


If you're struggling to even create a class you're really going to struggle doing anything more advanced. I'd get a book on c# and start learning the basics before moving on to anything else.
 
Share this answer
 
You don't add a using statement for individual classes, just the namespace they are in:
C#
using System.Drawing;

You can then use the class:
C#
Bitmap bm = (Bitmap) Bitmap.FromFile(@"D:\Temp\MyImage.bmp");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900