|
aquahoya wrote: The type or namespace name Ean13; could not be found (are you missing a using directive or an assembly reference?
This simply means that you have referenced a class or namespace that is not part of your project. It seems you need to add the class(es) from the article, or create your own class and add the necessary parts of the code.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hello aquahoya,
It sounds like the class Ean13 that you created in step 1 is in a different project from your main form that you created in step 2. If that is the case you need to do something like the following:
Find the "Solution Explorer" in Visual Studio and expand the project that contains your main form. Right click on "References" under that project and select "Add reference..." from the menu. Select the "Projects" tab from the dialog box that opens. It should contain "Ean13" in the list of projects. Select it and press the "OK" button.
This is based on Visual Studio 2010, if you have a different version it might be slightly different but the same process. Good luck.
BDF
I often make very large prints from unexposed film, and every one of them turns out to be a picture of myself as I once dreamed I would be.
-- BillWoodruff
|
|
|
|
|
I believe you're both right, but there isn't any projects once I click "ADD REFERENCE" even tho I added a new class called Ean13.cs
Since you can't attach screenshots I think, I uploaded it to a friends domain:
http://www.thewalkingdeadseason3.com/problem1.jpg
if you want me to upload the pic anywhere else let me know, or if u want me to make more screenshots so you can further help me I will.
Please help me guys 
|
|
|
|
|
It looks like Ean13 is in the same project as the form, unlike what I had assumed. That's OK. Moving on, let's go back to the error message: "The type or namespace name Ean13; could not be found (are you missing a using directive or an assembly reference?)" We have ruled out the assembly reference reference so let's focus on the using directive.
Look in your source files, you'll see "namespace WindowsFormsApplication5" in the Form1.Designer.cs file. See what namespace is in the Ean13.cs file. In the article you're using, it's "namespace Ean13Barcode2005" or you might have changed it to something else. In the file where you're trying to use the Ean13 class, you'll need a using directive such as,
using Ean13Barcode2005;
This is to help the compiler can "find" the Ean13 class.
BDF
I often make very large prints from unexposed film, and every one of them turns out to be a picture of myself as I once dreamed I would be.
-- BillWoodruff
|
|
|
|
|
Thanks Farang for the help, but after I added 'using Ean13Barcode2005;' it DID in fact build, however when I try to use the button to create the barcode, it won't draw at all
Am I missing something in my new code that prevents the barcode from drawing to the picturebox?
So far thanks very much for your help you almost have this figured out for me
EDIT: wait I think it's a button_click problem. One second =)
modified 11-Apr-12 15:54pm.
|
|
|
|
|
Thanks so much everyone especially you Farang. If I have any further problems with this issue I'll be sure to let you know
thanks again!
|
|
|
|
|
Glad to be of help and even more glad you got it working!
BDF
I often make very large prints from unexposed film, and every one of them turns out to be a picture of myself as I once dreamed I would be.
-- BillWoodruff
|
|
|
|
|
What i mean,
i keep finding out spots in c# where i think,
microsoft but why.
For example the ICollection-generic interface
which has been derived van IEnumerable and IEnumerable-generic
which let u implement the same named function only with a different return type and u think like, that can't be so how can i not implement icollection and list, dictionary etc while microsoft can.
Why is it that i need to cast a dictionary to ICollection-KeyValuePair first before i can call the dictionary's CopyTo method to get it's whole list and not just values or keys.
Or for instance when u work with an dictionary the way i do
in my latest program for my work i want copies of the retrieval
cause i need to detect chances against the dictionary.
I Used to make a getcopy function where i would pass the object
and would return a new instance filled with the data from the other.
Then when i was playing around a bit u find out that object
has MemberwiseClone only u can't access it normally.
I ended up writing the next for something which is present
on each object (should need less flags, wasn't in the mood to find out which i could skip)
private const System.Reflection.BindingFlags FullAccess = System.Reflection.BindingFlags.CreateInstance |
System.Reflection.BindingFlags.GetField |
System.Reflection.BindingFlags.GetProperty |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.InvokeMethod |
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.SetField |
System.Reflection.BindingFlags.SetProperty |
System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.NonPublic;
public static T GetMemberWiseClone<T>(T ToClone)
{
T Result = default(T);
if (ToClone != null)
{
try
{
Result = (T)ToClone.GetType().GetMethod("MemberwiseClone", FullAccess).Invoke(ToClone, new object[] { });
}
catch { }
}
return Result;
}
All such small things just make me like, microsoft why do u hide
certain things, why do u make some things less accessible or unimplemetable
or is it just me?
|
|
|
|
|
There's some rough edges around Collections.Generic because they had already implemented Collections (non-generic) in .Net 1 and they decided (rightly, in my view) that generic collections should play nicely with non-generic code and language constructs (e.g. foreach), so they have to implement the non-generic interfaces as well.
You can implement ICollection<T>, IEnumerable<T> etc by using explicit interface implementations for the non-generic interface.
MemberwiseClone is protected because it doesn't do what you think it does, and it's there as a piece of plumbing to make writing a proper clone method easier. Unless the target type is actually implementing MemberwiseClone to do something useful, you're introducing nasty subtle bugs by using it.
|
|
|
|
|
There are some odd things in .net, but this isn't one of them.
You should not write a general-purpose cloner because some class hierarchies are cyclical (think of classes with parent/child relationships that refer to each other) and could cause a stack overflow.
If you have a specific class for which you want a cloner then write a specific clone method for that class.
Furthermore, swallowing the Exception in your method is nasty.
|
|
|
|
|
The function written in my question was a 3 minute wrap, not yet formatted for my real program (which as i normally do tries to escape most errors by testing on validity before i make the call, besides that likely i'll introduce a boolean on return and the return value as an out variable)
But that about the function.
Does memberwiseclone does something different then copying fields bitwise and referenced objects by reference
?
And for the things i apply them are structures/classes which are only ment for data storage (iow abusing dictionaries for speedy retrieval of my mini in memory database like environment) i think that's more then enough.
Though if it can cause unwanted results it's handy to know that. But ain't that the same for createhandle and destroyhandle of a nativewindow etc. U need to know how to handle them and normally that would be by a good documentation of the function for everyone to read, which likely is present for memberwiseclone as well.
|
|
|
|
|
Mark Kruger wrote: But that about the function
MSDN[^]
Bastard Programmer from Hell
|
|
|
|
|
Exactly
But still u know often when u just have enough with a shallow copy, cause u created the class/structure etc u need an not original reference instance from.
And that's exactly where i made the function for.
Just to let me not dumb re-re-re-re enter the same line of code over and over again, nor gives me need to inherit a base class which makes it public
|
|
|
|
|
If you created the class you can provide a public Clone method which has an exactly specified interface and definition of its action.
If you are simply using an existing class, you can never know if MemberwiseClone will do what you want, because shallow copying private fields is dependent on the implementation of the class, and it is entirely legitimate for the class provider to update the private workings of the class in a way which will change how it operates.
For example, using a list: if the class you're using is simply a wrapper around an internal inner list class, you'll be getting essentially the same object after MemberwiseClone (and actions like Add will apply to both copies); if information is stored in fields of the class you're using, list modifying methods will (mostly) only apply to one copy. And you can't possibly tell which of those two it is going to be (you can use ILDASM or similar to find out what it is right now, but it might not be the same in the next release, or in the Compact Framework, or under Mono).
|
|
|
|
|
A clear view i understand and agree with, thank you
Cause of the reactions yesterday ended up writing a field reader writer (including basetypes), which works on arrays and icollection(generic only) as well (and specially in those occations to make of copy of each cell) recursivly with an object array[,] to be able to detect when items and pointing to somethin' processed before in that case i place the copied variant on the spot. Implemented all real valuetypes (iow int, long, decimal, string) by individually copy lines to make sure those go well. Called my function GetDeadCopy and returns a boolean now whether it had succes or not. Have not implemented a field checker yet for combi with collection to see what's touched. But the total function does already a lot more then were i wrote the thing for. Being more easily able to use data packages in dictionaries and lists without having the need to give each package an own copy constructor (or clone however you want to name it).
Anyways thanx for the responds and the reason for me to look a bit deeper.
|
|
|
|
|
Please use "you" instead of "u".
thanks.
V.
|
|
|
|
|
where to get tutorials or ebook. 
|
|
|
|
|
Have you heard of Google[^]?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
It's a fad.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Yeah, I wonder if it'll last?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
can anybody help me in solving this deadlock?
class Program
{
readonly static object obj1 = new object();
readonly static object obj2 = new object();
static void F1()
{
lock (obj1)
lock (obj2)
{
Console.Write("1");
}
}
static void F2()
{
lock (obj2)
lock (obj1)
{
Console.Write("2");
}
}
static void Main(string[] args)
{
Task[] tasks = new[]
{
Task.Factory.StartNew(() => { for (int i = 0; i < 100; i++) F1(); }),
Task.Factory.StartNew(() => { for (int i = 0; i < 100; i++) F2(); }),
};
Task.WaitAll(tasks);
Console.WriteLine();
Console.WriteLine("all done");
}
}
|
|
|
|
|
Rather than using the locks the way you are doing it, try using Monitor.TryEnter instead. That provides a timeout that allows you to set how long it needs to wait before it gives up trying to acquire the lock.
|
|
|
|
|
can you clearly write your repaired code here?
|
|
|
|
|
numeracy wrote: write your repaired code
I am sure that he could, but why would he? Are your fingers broken?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
in fact, i don't understand his ideal(( so i can't
|
|
|
|