I want to print in the same report page a determinate number of the same barcode, I used this code but it does not work:
' ###### I try to repeat the function to generate the same barcode 6 times #######
Private Sub ExampleBarcode_BeforePrint(sender As Object, e As System.Drawing.Printing.PrintEventArgs) Handles Me.BeforePrint
For i As Integer = 1 To 6
Me.Detail.Controls.Add(CreateQRCodeBarCode("01234ft78"))
Next
End Sub
Public Function CreateQRCodeBarCode(ByVal BarCodeText As String) As XRBarCode
Dim barCode As New XRBarCode()
barCode.Symbology = New Code128Generator()
barCode.Text = BarCodeText
barCode.Width = 240
barCode.Height = 70
barCode.Module = 1
CType(barCode.Symbology, Code128Generator).CalcCheckSum = False
CType(barCode.Symbology, Code128Generator).CharacterSet = Code128Charset.CharsetAuto
Return barCode
End Function
Your barcodes are located at the same location. You need to set different locations for each of the controls. For this you can use LeftF
and TopF
properties.
Here is example:
For i As Integer = 0 To 5
Dim barCode = CreateQRCodeBarCode("01234ft78")
barCode.TopF = i * barCode.HeightF
Me.Detail.Controls.Add(barCode)
Next