|
Thanks!! That works really well. The only problem is that when I have a 0, it's showing it as 0 instead of 00. Any thoughts?
|
|
|
|
|
My fault - change the X00 to X02:
values[i++] = string.Format("{0:X02}", b);
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
|
friend give some example about a small project.that must be unique.plz say what type of project is best for me.in C#..//(small project)becz its my first
|
|
|
|
|
Write an app to take over the world.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
That might be a bit ambitious, "becz its my first." [sic]
Besides, I've been working on that for a couple of years now!
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
|
|
|
|
|
Clearly you have not finished, or we would have known by now.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
Narf.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello world with a twist. Can't guarantee it's unique though.
public class Goodbye
{
public static void Main()
{
System.Console.WriteLine("Goodbye, cruel world!");
}
}
"You get that on the big jobs."
|
|
|
|
|
Hi all !
I want o export 2 datagridview in 2 sheets of An Excel File .
some code for one DataGridView is Here :
...
Microsoft.Office.Interop.Excel.Worksheet mySheetInputData = null;
try
{
mySheetInputData = (Microsoft.Office.Interop.Excel.Worksheet)ExWorkBookInputData.Sheets["Sheet1"];
mySheetInputData = (Microsoft.Office.Interop.Excel.Worksheet)ExWorkBookInputData.ActiveSheet;
mySheetInputData.Name = "First Sheet";
for (int i = 1; i < dgv.Columns.Count + 1; i++)
{
mySheetInputData.Cells[1, i + 1] = dgv.Columns[i - 1].HeaderText;
}
for (int j = 1; j < dgv.Rows.Count + 1; j++)
{
mySheetInputData.Cells[j + 1, 1] = dgv.Rows[j - 1].HeaderCell.Value.ToString();
}
for (int i = 0; i < dgv.Rows.Count; i++)
{
for (int j = 0; j < dgv.Columns.Count; j++)
{
mySheetInputData.Cells[i + 2, j + 2] = dgv.Rows[i].Cells[j].Value.ToString();
}
}
string fileNameInputData = String.Empty;
SaveFileDlgInputData.Filter = "Excel Files (*.xlsx)|*.xlsx";
SaveFileDlgInputData.FilterIndex = 2;
SaveFileDlgInputData.RestoreDirectory = true;
if (SaveFileDlgInputData.ShowDialog() == DialogResult.OK)
{
fileNameInputData = SaveFileDlgInputData.FileName;
ExWorkBookInputData.SaveAs(fileNameInputData, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing,
Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
}
else
return;
...
thanks for any help
|
|
|
|
|
Hello again CodeProject I'm having trouble integrating this codeproject barcode project code with my own barcode project. Heres the codeproj: Creating EAN-13 Barcodes with C#[^]
I have extreme difficulty when trying to create EAN13 barcodes myself so I wanted to use rainman_63's code with my project for my product's labels. Problem is I have no idea how to integrate it with mine, or ANY project.
1st) I add a class, and call it Ean13. Then I add 4 textboxes(name them appropriately like in rainman's project) then add buttons and the picturebox where you draw the barcode in the form1[Design].
2nd) I add partial class frmEan13 : Form to form1.cs
but I get this error when trying to build it: "The type or namespace name Ean13; could not be found (are you missing a using directive or an assembly reference?)"
Please help because I have NO idea how to integrate his Ean13 code with my project. Please don't flame me for being pretty new to C#
|
|
|
|
|
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
|
|
|
|