473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.

Expand|Select|Wrap|Line Numbers
  1.  Protected Sub cmdGenerate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdGenerate.Click
  2.         Dim connActive As New SqlConnection(Session("db_conn_str"))
  3.  
  4.         Dim arParam(1) As SqlParameter
  5.         arParam(0) = New SqlParameter("@param_type", Me.txtType.Text)
  6.  
  7.         Dim drActive As SqlDataReader = SqlHelper.ExecuteReader(connActive, CommandType.StoredProcedure, "usp_CS_Barcode_GetLastGenCode", arParam)
  8.  
  9.         If drActive.Read() Then
  10.             Me.lblMessage.Text = ""
  11.             Dim type As String = drActive.GetValue(2)
  12.             Dim lastgen As Integer = drActive.GetValue(4)
  13.  
  14.             For i As Integer = 1 To Me.txtQuantity.Text
  15.                 lastgen += 1
  16.                 Dim newsealno As String = lastgen
  17.                 While newsealno.Length < 8
  18.                     newsealno = "0" + newsealno
  19.                 End While
  20.  
  21.                 Dim barcode As String = type + newsealno
  22.  
  23.                 Dim factor As Integer = 3
  24.                 Dim sum As Integer = 0
  25.  
  26.                 For j As Integer = 0 To barcode.Length - 1
  27.                     sum = sum + barcode.Substring(j, 1) * factor
  28.                     factor = 4 - factor
  29.                 Next
  30.  
  31.                 Dim checkdigit As Integer = 1000 - (sum mod 10)
  32.  
  33.                 Dim FinalBarCode As String
  34.                 FinalBarCode = "*" + barcode + checkdigit.ToString + "*"
  35.                 lblMessage.Text += FinalBarCode + "<br><br>"
  36.             Next
  37.         End If
  38.         drActive.Close()
  39.         connActive.Close()
  40.  
  41.     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.
Feb 24 '09 #1
2 2911
tlhintoq
3,525 Expert 2GB
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.
Expand|Select|Wrap|Line Numbers
  1. C#:
  2. textControl1.Selection.Text = "\f";
  3. VB .NET:
  4. TextControl1.Selection.Text = Chr(12)
  5.  
Feb 24 '09 #2
hi all, the problem solved with output the computed barcode to xml file and bind it to crystal report.
Mar 16 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: george lewycky | last post by:
I have Oracle Apps ( AR & GL) and I working on creating our own Invoice but I'm unsure about certain aspects of PL/SQL & Printing. I have some PL/SQL working with the invoice data from...
16
by: gb | last post by:
Hi All, Ive created a popup page using 'var openWindow = window.open("new","pop")' And added content using openWindow.document.write(" "); statements. But now I would like to be able to print...
0
by: James | last post by:
We have a page that reads records from a database and displays them. Basically name/address/city/state/zip/county/phone. These records are between 4-6 lines a piece (there are other variables...
2
by: Jurjen de Groot | last post by:
I'm about to start a new ASP.NET application, this application will generate several types of documents (PDF HTML XML-DOC) wich have to be printed at the client-side... (probably on different...
6
by: Bill | last post by:
Hi I am trying to get my listbox items to print if they stream past the one page mark. my code is working for one page of information (if the e.hasmorepages) is not there. But I am having...
8
by: CJM | last post by:
What is the best way to force a page break when printing from a browser? A page in my application generates a series of tables which are usually less than will fit on a page of A4. Ideally I want...
4
by: LuTHieR | last post by:
Hi, is there any way to write a header in each HTML page when printing them while leaving the header only on top of the file when viewing it? I mean, I have a file that looks like this: TITLE ...
0
by: Cruelemort | last post by:
All, I have just had to start looking at printing using CSS and have run into a bit of a problem. I have a div on my page that has a database- rendered Gantt chart type thing in it. This can get...
4
by: kalyan | last post by:
Hi All I have a table with 10 rows and 15 columns...when i click on a button each row should be printed in a single page with the line break to the corresponding columns of that particular...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.