CHR$(&H1B) in c#

  • Thread starter Thread starter calvin.chan.cch
  • Start date Start date
C

calvin.chan.cch

VB
PRINT #1, CHR$(&H1B);"a";CHR$(1);


I try to port into C#, but it is not working,
C#
st1 = "test" + (char)27 + (char)97 + (char)1;
PrintDirect.WritePrinter(lhPrinter, st1, st1.Length, ref pcWritten);

anyone have idea ?

I could print "test" in the follwoing statment
st1 = "test";1
 
What makes you think that the string is not working?

This code will build a string that is test<ESC>a<SOH> which is the same as
what the VB code was building.

Perhaps there is a problem elsewhere?

Cheers,

Greg
 
Use can use escape codes in the string:

st1 = "test\u001ba\u0001";
 
Back
Top