-
Label Printing Help
I am trying to create a simple app that will print barcode labels based on a range entered by a user.
The problem i have is that with the following code the label values are all the same:
Code:
Dim SA As SECURITY_ATTRIBUTES
Dim hPortP As IntPtr
Dim poStart As Integer = txtStart.Text
Dim poEnd As Integer = txtEnd.Text
Dim i As Integer = poStart
objhPort = CreateFile(objLPTPORT, objGENERIC_WRITE, _
objFILE_SHARE_WRITE, SA, objOPEN_EXISTING, 0, 0)
hPortP = New IntPtr(objhPort)
outFile = New FileStream(hPortP, FileAccess.Write, False)
fileWriter = New StreamWriter(outFile)
fileWriter.WriteLine("N")
Do Until i = poEnd + 1
fileWriter.Write("A120,30,0,a,1,1,N,")
fileWriter.Write(Chr(34))
fileWriter.Write("*PO" & i & "*")
fileWriter.Write(Chr(34))
fileWriter.Write(Chr(13))
fileWriter.Write(Chr(10))
i = i + 1
fileWriter.WriteLine("P1")
fileWriter.Flush()
Loop
fileWriter.Close()
outFile.Close()
retval = CloseHandle(objhPort)
If i add all the code within the the loop, the label values are correct but it prints out slow because the printer prints out a label sets itself then prints the next one.
Im using a Thermal printer so speed of the printing is key.
Thanks for any help.