Asked by:
I am doing bar-code system i face my IDAutomation will not be change when i insert new number can help me take a look.Thanks

Question
-
Imports System.Drawing.Imaging
Imports IDAutomation.Windows.Forms.LinearBarCode
Imports System.Drawing.Printing
Imports System.Configuration
Imports GenCode128
Public Class Form1
Private WithEvents pdPrint As PrintDocument
Private PrintDocType As String = "Barcode"
Private StrPrinterName As String = "Microsoft XPS Document Writer"
Dim pbImage2 As New PictureBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub pdPrint_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pdPrint.PrintPage
Dim rect As New Rectangle(0, 10, 280, 85)
Dim sf As New StringFormat
sf.LineAlignment = StringAlignment.Center
Dim printFont10_Normal As New Font("Calibri", 10, FontStyle.Regular, GraphicsUnit.Point)
rect = New Rectangle(0, 10, 280, 15)
e.Graphics.DrawString("IDAutomation", printFont10_Normal, Brushes.Black, rect, sf)
e.Graphics.DrawRectangle(Pens.White, rect)
Dim h, w, h2, w2 As Integer
Dim pbImage As New PictureBox
pbImage.Image = Image.FromFile(Application.StartupPath & "\" & "SavedBarcode.Jpeg")
w = Image.FromFile(Application.StartupPath & "\" & "SavedBarcode.Jpeg").Width
h = Image.FromFile(Application.StartupPath & "\" & "SavedBarcode.Jpeg").Height
Dim lPosition As Integer
lPosition = (280 - w) / 2
rect = New Rectangle(50, 25, w, h)
e.Graphics.InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
e.Graphics.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
e.Graphics.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighQuality
e.Graphics.DrawImage(pbImage.Image, rect)
e.Graphics.DrawRectangle(Pens.White, rect)
rect = New Rectangle(0, 95, 280, 15)
e.Graphics.DrawString("", printFont10_Normal, Brushes.Black, rect, sf)
e.Graphics.DrawRectangle(Pens.White, rect)
rect = New Rectangle(0, 105, 280, 15)
e.Graphics.DrawString("GEN128Barcode", printFont10_Normal, Brushes.Black, rect, sf)
e.Graphics.DrawRectangle(Pens.White, rect)
w2 = pbImage2.Width
h2 = pbImage2.Height
rect = New Rectangle(50, 130, w2, h2)
e.Graphics.InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
e.Graphics.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
e.Graphics.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighQuality
e.Graphics.DrawImage(pbImage2.Image, rect)
e.Graphics.DrawRectangle(Pens.White, rect)
rect = New Rectangle(70, 185, 280, 15)
e.Graphics.DrawString(txtBarcode.Text.ToString(), printFont10_Normal, Brushes.Black, rect, sf)
e.Graphics.DrawRectangle(Pens.White, rect)
rect = New Rectangle(0, 215, 280, 15)
e.Graphics.DrawString("", printFont10_Normal, Brushes.Black, rect, sf)
e.Graphics.DrawRectangle(Pens.White, rect)
End Sub
Private Sub btnGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGenerate.Click
'ID Automation
'Free only with the Code39 and Code39Ext
Dim NewBarcode As IDAutomation.Windows.Forms.LinearBarCode.Barcode = New Barcode()
NewBarcode.DataToEncode = txtBarcode.Text.ToString() 'Input of textbox to generate barcode
NewBarcode.SymbologyID = Symbologies.Code39
NewBarcode.Code128Set = Code128CharacterSets.A
NewBarcode.RotationAngle = RotationAngles.Zero_Degrees
NewBarcode.RefreshImage()
NewBarcode.Resolution = Resolutions.Screen
NewBarcode.ResolutionCustomDPI = 96
NewBarcode.RefreshImage()
NewBarcode.SaveImageAs("SavedBarcode.Jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)
NewBarcode.Resolution = Resolutions.Printer
imgIDAutomation.Image = Image.FromFile(Application.StartupPath & "\" & "SavedBarcode.Jpeg")
'Barcode using the GenCode128
Dim myimg As Image = Code128Rendering.MakeBarcodeImage(txtBarcode.Text.ToString(), Integer.Parse(txtWeight.Text.ToString()), False)
imgGenCode.Image = myimg
pbImage2.Image = myimg
'Barcode using the GenCode128
End Sub
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
Try
pdPrint = New PrintDocument
pdPrint.PrinterSettings.PrinterName = StrPrinterName
pdPrint.PrintController = New StandardPrintController
If pdPrint.PrinterSettings.IsValid Then
pdPrint.DocumentName = PrintDocType
pdPrint.Print()
End If
Catch ex As Exception
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.imgIDAutomation.Text = ""
End Sub
End ClassWednesday, July 3, 2019 5:15 AM
All replies
-
Imports VBCode39.Barcodes
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Barcodes.Barcode39.Value = TextBox1.Text
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub chkShowText_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkShowText.CheckedChanged
Barcode39.ShowBarcodeText = chkShowText.Checked
End Sub
Dim pageNumber As Integer = 1
Dim numberOfPages As Integer = 1
Dim i As Integer = 0
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
If PrintDialog1.ShowDialog() = DialogResult.OK Then
PrintDocument1.PrinterSettings = PrintDialog1.PrinterSettings
PrintDocument1.Print()
End If
End Sub
Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreview.Click
PrintPreviewDialog1 = New PrintPreviewDialog()
PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.Show()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
numberOfPages = Integer.Parse(nudPages.Value.ToString())
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class- Merged by Alex-KSGZ Thursday, July 4, 2019 1:30 AM same case
Wednesday, July 3, 2019 9:50 AM -
Hello,
Is VBCode39 a third party library and if so did you ask the author?
Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
NuGet BaseConnectionLibrary for database connections.
Wednesday, July 3, 2019 10:15 AM -
Karen,
Is most of barcode project is need the .dll file to support. i have view many barcode project most of them is need use the .dll file to complete.
- Edited by christing Thursday, July 4, 2019 12:18 AM
Thursday, July 4, 2019 12:17 AM