|
It's a static method - no constructor needed.
System.Windows.Forms.MessageBox.Show("You must enter a name.",
"Name Entry Error",MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
uhh what are you talking about?
maybe its the wrong question assigned. lol
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Hi,
I'm working on a POS project using C# .NET. For now, I don't have a barcode reader and a receipt printer which are definitly a MUST for a POS system in the future.
I would like to know the nature of these two things, so that when i program the POS system, I know how to program as a way of using these two things.
I cannot purchase these two items before the completion of the project. So, I totally cannot try in my program or even know what it is. I want to program my system so that i do not need to have a big modification when i purchase these two things afterward.
Please help!
|
|
|
|
|
I have worked on a few POS systems in the past.
There are a few things to take into consideration.
1. What type of barcode scanner do you plan to use. If you are using a a wedge reader then the data that is read will be just like pasting a block of text into a edit box and it can be read simply. If the scanner is a COM port based scanner you will need to write a device driver or serial port capture routines to read the data. There is a good serail port class on this site http://www.codeproject.com/system/cserialport.asp.
2. Which barcode will you be using ??? Sometimes the barcode will contain additional characters that you are not interested in. The data that will be read in may have an extra characters at the start and/or end (e.g. check digit) depending on the barcode type and reader. Usually POS systems use the barcode EAN-13 (european standard) or EAN-8 (Which I think is the US standard)
3. POS Printer. You can simulate having a POS Printer. Do you have access to a printer? The only real programming difference between a POS printer is the width of the paper. You can setup your printer with a custom size paper that matches the width of the intended POS reciept printer and it will be just as if you has the receipt printer.
Hope this helps.
|
|
|
|
|
Thank you very much!!!! Your advice helps me a lot@!!!! Thanks
AdrianT wrote:
1. What type of barcode scanner do you plan to use.
I don't know. But i think I will look for some reader that support USB. And I heard from someone that some reader plug into the PS/2 port (for keyboard or mouse..). Am I thinking something right?
AdrianT wrote:
If you are using a a wedge reader
What is wedge reader? (i guess normal reader that plug in keyboard wedge or USB? i saw something: USB Adapter for Keyboard Wedge Barcode Scanners from web http://www.skandata.com/usb.html. So I guess wedge is that "plug" for keyboard??!! )
AdrianT wrote:
then the data that is read will be just like pasting a block of text into a edit box and it can be read simply.
Is that mean after reading the barcode, it just acts as a person typing character from keyboard or number pad then leave it there? (no return or ENTER signal?)
AdrianT wrote:
2. Which barcode will you be using ???
I think I will use the American standard (i'm in Canada). Since it is a bookstore POS, I will use the barcode behind each books or cards and print some barcodes by my own for other items (such as gift)
AdrianT wrote:
3. POS Printer.
That means i can just set the page size as small as a receipt, then use my home printer to simulate it...right? Oh.....easy...haha...
THANK YOU VERY MUCH!!!!!! ;);P
|
|
|
|
|
if its an object why not include general methods that can be adapted later
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
hi,
QUESTION 1: i understand you can add modifier to interface:
public interface IA
{
public void DoA(); //Yes, I understand this is INVALID - so, I didnt do this.
void DoB();
void DoC();
double salary
{
get;
}
}
But I thought access modifier is OK when you declare implementation in class? I tried access access modifier in class but the compiler keep bitching that it's NOT legal to do so - and it didnt provide error code (like C1324)! See "QUESTION" below:
public class Capitalist : IA, IB, ICapitalist //QUESTION 2: Can you specify public/private... in interface inheritance? How?
{
//Implement interface IA:
public void IA.DoA() //QUESTION 1: compiler complained here!!
{
Console.WriteLine("Capitalist.IA.DoA");
return;
}
void IA.DoB() //This, on the other hand, is oK.
{
Console.WriteLine("Capitalist.IA.DoB");
return;
}
... and the rest of it ...
}
THanks!
norm
|
|
|
|
|
|
You can append access modifer when you implement it in a class, PROVIDED that the interface is not the base interface of another interface that the class implements.
Using example below, IAccMaintenance is the base interface of IAccManager:
interface IAccMaintenance
{
int EditAccProfile(...); //DO NOT append access modifer to this method when you implement it.
}
interface IAccManager : IAccMaintenance
{
...
}
Now, when you implement it in a class:
class SiteManager : IAccManager
{
public int IAccManager.CreateAcc(...) {...} //That's OK. You can use access modifier here.
public int EditAccProfile(...) {...} //ERROR: You can't use access modifier - the method comes from an interface that's not directly inherited. But why would .NET team design it this way???
...
}
***********************************************************************
In case you want to just compile the code and see...
using System;
namespace try_interface2
{
public interface IAccMaintenance
{
int EditAccProfile(int accID);
}
public interface IOldAccMaintenance
{
int EditAccProfile(int accID);
}
public interface IAccManager : IAccMaintenance, IOldAccMaintenance
{
int CreateAcc(string accType, int accID);
int DestroyAcc(int accID);
int numAccount
{
get;
set;
}
}
interface IConnManager
{
int Connect(string Destination, int connID);
int Disconn(int connID);
}
class CSiteManager : IAccManager, IConnManager
{
protected int m_numAccount;
//(1) Implementing IAccManager interface:
public int CreateAcc(string accType, int accID)
{
Console.WriteLine("CreateAcc... account type: {0}, account ID: {1}", accType, accID.ToString());
return 1;
}
public int DestroyAcc(int accID)
{
Console.WriteLine("Destroy Acc... account ID: {0}", accID.ToString());
return 1;
}
public int numAccount
{
get{ return m_numAccount; }
set{ m_numAccount=value; }
}
int IAccMaintenance.EditAccProfile(int accID)
{
int err=0;
Console.WriteLine("edit acc profile ver 0. accID: {0}", accID);
return err;
}
int IOldAccMaintenance.EditAccProfile(int accID)
{
int err=0;
Console.WriteLine("edit acc profile ver 0. accID: {0}", accID);
return err;
}
//(2) Implementing IConnManager interface (Default method access modifier: private):
int IConnManager.Connect(string Destination, int connID)
{
int err=0;
Console.WriteLine("Connect... destination: {0} connID: {1}", Destination, connID);
return err;
}
int IConnManager.Disconn(int connID)
{
int err=0;
Console.WriteLine("Disconn... connID: {0}", connID);
return err;
}
}
///
/// Summary description for Class1.
///
class AppClass
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
CSiteManager siteManager = new CSiteManager();
siteManager.CreateAcc("developer_premimum", 731);
siteManager.DestroyAcc(423);
siteManager.numAccount = 14302;
Console.WriteLine("Number of registered accounts: {0}", siteManager.numAccount);
}
}
}
norm
|
|
|
|
|
From MSDN[^]:
All interface members implicitly have public access. It is a compile-time error for interface member declarations to include any modifiers. In particular, interfaces members cannot be declared with the modifiers abstract, public, protected, internal, private, virtual, override, or static.
Hope this helps.
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
i know. That's why I didn't add any access modifier in interface declaration. But in the class that implements it... the code is below, compile it and see for yourself:
using System;
namespace deda
{ //namespace deda
public interface IA
{
void DoA();
void DoB();
void DoC();
double salary
{
get;
}
}
public interface IB : IA
{
new void DoA();
}
public interface ICapitalist
{
void HireSlave();
void FireSlave();
}
public class Capitalist : IA, IB, ICapitalist
{
//Implement interface IA:
public void IA.DoA()
{
Console.WriteLine("Capitalist.IA.DoA");
return;
}
void IA.DoB()
{
Console.WriteLine("Capitalist.IA.DoB");
return;
}
void IA.DoC()
{
Console.WriteLine("Capitalist.IA.DoC");
return;
}
public double salary {
get{ return m_salary;}
}
//Implement interface IB:
void IB.DoA()
{
Console.WriteLine("Capitalist.IB.DoA");
return;
}
//Implement interface ICapitalist:
void ICapitalist.HireSlave(){
Console.WriteLine("Capitalist hiring");
return;
}
void ICapitalist.FireSlave(){
Console.WriteLine("Capitalist layoff people");
return;
}
//Class' protected attributes:
protected double m_salary;
}
} //namespace deda
norm
|
|
|
|
|
I think one is called implicit implementation.
Like this
IA.Dob()
{
}
if you want to use access modifiers then
like he said.
public void Dob()
{
}
Bo Hunter
|
|
|
|
|
Hi, just want to know how to separate method declaration and implementation.
Example:
namespace anothersucker
{
public class SomeClass : IA, IB, IC
{
//QUESTION: How can I do implementation elsewhere so I can separate declaration and implementation like we do in C++
public void DoA() {return;}
protected void DoB() {return;}
public void DoC() {return;}
public void DoD() {return;}
}
}
norm
|
|
|
|
|
|
|
|
no, .NET is not lame at all, big step forward from the lame MFC. i was just bitching that you can't separate declaration and implementation in C#.
.net framework is so much more intuitive and organized and with much shorter learnign curve than MFC/WIN32. documentation is much better.. just so much better.
norm
|
|
|
|
|
I'll agree with that. I'll be most happy if/when they finally make C# be a language that keeps up with modern concepts (which it does now), does not have the excess baggage/clutter of C++ (C# is good here), AND has the power that C++ achieves (they have a ways to go here). It's definitely not too hard to accomplish.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
despite all .net languages compile to MSIL, i thought managed C++ has more optimized IL than others?
norm
|
|
|
|
|
No, it doesn't. But you can mix managed and unmanaged code in Managed C++.
BTW, what makes managed code slower than unmanaged code is that it has to be compiled at runtime.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
jdunlap wrote:
what makes managed code slower than unmanaged code is that it has to be compiled at runtime
Don't forget about all of the code optimizations your regular C/C++ compilers will make. While it is possible for the JIT compiler to do this in the future, I don't think it can optimize as much as the unmanaged C++ compiler, yet.
James
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
One way to approximate that is use delegates.
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
is there any way to remove duplicates in an array or an arraylist? i see there are no functions, but i'm having a hard time wrapping my head around making an function which will do this.
|
|
|
|
|
Why don't u try using another class like Hashtable or DictionaryEntry struct..
they take a key-value pair..and do not allow duplicate keys..
also the read/access time of these is O(1)
|
|
|
|
|
Krishnan11111977 wrote:
also the read/access time of these is O(1)
Thats not quite correct, it is realistically close to O(1) but under bad circumstances it can be O(n).
Unfortunately, I've seen examples where people override GetHashCode and have it return a constant value. This would be one of those 'bad circumstances' because the Hashtable would have to search through all of the keys that returned the same hash code (ie all of them) to find the correct key.
Usually this is done when someone doesn't know how they should override GetHashCode when they override Equals . The contract is that if two objects are considered equal then the hash code must be the same. Another part of the contract is that an object must return the same hash code over its lifetime. Because of those two details, it can be tricky for someone to correctly override GetHashCode while also overriding Equals .
I didn't intend to write this much, honest!
[edit]I do agree, using a Hashtable should be a quick way of determining if you have a duplicate item.[/edit]
James
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|