Pergunta

I'm searching for a method where I can print something to the screen (in RichTextBox, for example) with a POS-printer.

The method I'm using now is the following: I send the string to a method and I paste this string to a RichTextBox, but the textbox doesn't recognize ESCAPE POS codes. So I have to replace these codes with something else. It would be much easier if I just could print the string (with the ESCAPE POS codes) directly to the screen or textbox.

Some code to explain my problem:

Dim ESC As String = Chr(&H1B)
Dim newLine = ESC + "|1lF"

printstring = "Omzet per Locatie-groep/artikel" + newLine
printstring += gTouchSettings.CompanyName + newLine
printstring += newLine
printstring += "Periode: " + Format(fromdate, "dd/MM/yyyy") + " - " +    
                    Format(todate, "dd/MM/yyyy") + newLine
printstring += newLine
printstring += "LocatieGr  Omschrijving   Aantal Ontvangen"
printstring += newLine
printstring += newLine

I can erase the newline, I have found the solution for that. But now I have this layout problem:

printstring += Left(MySqlDR!description & Space(27), 27) & 
                   Right("      " &    Format(MySqlDR!quantity, "###0"), 7)
printstring += Right("      " & Format(MySqlDR!item_price, "######0.00"), 8) + 
               newLine

This looks great when I print it on a POS printer, but in a TextBox it is horrible.

Foi útil?

Solução

You might want to use String.Format , it helps with aligning your strings and setting padding etc. check out These Examples

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top