Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I just installed my EPSON TM-T90 Receipt and I wanna test it using C#.
I tried googling it, but haven't learned much about it...

What I want to do is simply print a line of code, for example "Hello World".
I tried using the following:

C#
char esc = (char)27;
char ff = (char)12;
SerialPort port = new SerialPort("COM3", 19200, Parity.None, 8, StopBits.One);
port.Open();
port.Write(esc + "@Hello World!" + ff);
port.Close();


Yet it says that access to COM3 was denied.
It's installed, I used the official advanced driver that installed everything, it's showing in my available printers and when I installed it I selected the correct port which is COM3 and configured the Serial Interface already.
Posted
Updated 11-Jan-23 23:19pm
Comments
Zoltán Zörgő 11-Jul-12 7:45am    
Have you tried to send data with hyperterminal or putty?
[no name] 11-Jul-12 9:24am    
Usually access denied means that something else is using the port.

1 solution

The driver will have exclusive rights to that serial port in order to
drive the printer, and so protect itself from malicious code. Why not just use normal print processing via the standard printing utilities and classes?
 
Share this answer
 
Comments
Steven Borges 11-Jul-12 9:51am    
Well before installing the drivers I tried to print it aswell and it didn't work, no error would popup, yet it wouldn't print anything or give signal.

Uninstalled it again to test it and didn't work with the same code.
Steven Borges 11-Jul-12 10:15am    
It's printing now, had to change something, but basicaly what you said did the job, thank you.
delfuras 24-Jul-12 15:52pm    
what did you have to change? having exactly the same problem here. thanx

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