Bar code printing with page break after each bar code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DanielT
    New Member
    • Jan 2009
    • 4

    Bar code printing with page break after each bar code

    i'd like to print bar codes with page break after each bar code, below is my current codes.

    Code:
     Protected Sub cmdGenerate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdGenerate.Click
            Dim connActive As New SqlConnection(Session("db_conn_str"))
    
            Dim arParam(1) As SqlParameter
            arParam(0) = New SqlParameter("@param_type", Me.txtType.Text)
    
            Dim drActive As SqlDataReader = SqlHelper.ExecuteReader(connActive, CommandType.StoredProcedure, "usp_CS_Barcode_GetLastGenCode", arParam)
    
            If drActive.Read() Then
                Me.lblMessage.Text = ""
                Dim type As String = drActive.GetValue(2)
                Dim lastgen As Integer = drActive.GetValue(4)
    
                For i As Integer = 1 To Me.txtQuantity.Text
                    lastgen += 1
                    Dim newsealno As String = lastgen
                    While newsealno.Length < 8
                        newsealno = "0" + newsealno
                    End While
    
                    Dim barcode As String = type + newsealno
    
                    Dim factor As Integer = 3
                    Dim sum As Integer = 0
    
                    For j As Integer = 0 To barcode.Length - 1
                        sum = sum + barcode.Substring(j, 1) * factor
                        factor = 4 - factor
                    Next
    
                    Dim checkdigit As Integer = 1000 - (sum mod 10)
    
                    Dim FinalBarCode As String
                    FinalBarCode = "*" + barcode + checkdigit.ToString + "*"
                    lblMessage.Text += FinalBarCode + "<br><br>"
                Next
            End If
            drActive.Close()
            connActive.Close()
    
        End Sub
    I've tried to convert these codes into crystal report but not successful. What other alternative I have to print these bar codes with page break after each bar code? thanks in advance.
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Page break is what we used to call "form feed." Its decimal 12 or Hex 0C. I would think you should be able to add it to the end of your printing string after the barcode. You should be able to adapt this example to your need.
    Code:
    C#:
    textControl1.Selection.Text = "\f";
    VB .NET:
    TextControl1.Selection.Text = Chr(12)

    Comment

    • DanielT
      New Member
      • Jan 2009
      • 4

      #3
      hi all, the problem solved with output the computed barcode to xml file and bind it to crystal report.

      Comment

      Working...