VintaSoft Barcode .NET SDK v10.0
Code128ValueItem Class
Members  Example 




Vintasoft.Barcode.BarcodeInfo Namespace : Code128ValueItem Class
Contains information about value of Code 128 or Code 16K barcode.
Object Model
Code128ValueItem Class
Syntax
'Declaration
 
Public Class Code128ValueItem 
   Inherits TextValueItem
'Usage
 
Dim instance As Code128ValueItem
public class Code128ValueItem : TextValueItem 
public __gc class Code128ValueItem : public TextValueItem 
public ref class Code128ValueItem : public TextValueItem 
Example
Imports System.Drawing   
   
Imports Vintasoft.Barcode   
Imports Vintasoft.Barcode.BarcodeInfo   
   
''' <summary>   
''' Test that shows how to create an image with Code128 barcode with multiple value items.   
''' </summary>   
Class Code128ValueItemExample   
   
	''' <summary>   
	''' Runs the test.   
	''' </summary>   
	Public Shared Sub TestWriteBCBModes()   
		' create image with barcode   
		Using barcodeImage As Bitmap = WriteBCBModes("ABC", "12345678", "1234ABC")   
			' create the barcode reader   
			Using reader As New BarcodeReader()   
				' specify that reader must search for Code128 barcodes only   
				reader.Settings.ScanBarcodeTypes = BarcodeType.Code128   
   
				' read barcode from image   
				Dim barcodeInfo As IBarcodeInfo = reader.ReadBarcodes(barcodeImage)(0)   
   
				' print barcode value   
				Console.WriteLine("Value = {0}", barcodeInfo.Value)   
				' print value items   
				Console.WriteLine("ValueItems:")   
				For Each item As Code128ValueItem In barcodeInfo.ValueItems   
					Console.WriteLine("[{0}] {1}", item.Mode, item.Value)   
				Next   
			End Using   
		End Using   
	End Sub   
   
	''' <summary>   
	''' Writes the Code128 barcode in B, C, B modes.   
	''' </summary>   
	Public Shared Function WriteBCBModes(part1B As String, part2C As String, part3B As String) As Bitmap   
		' create value items   
   
		Dim part1 As New Code128ValueItem(part1B, Code128EncodingMode.ModeB)   
		Dim part2 As New Code128ValueItem(part2C, Code128EncodingMode.ModeC)   
		Dim part3 As New Code128ValueItem(part3B, Code128EncodingMode.ModeB)   
   
		' create the barcode writer   
		Dim writer As New BarcodeWriter()   
   
		' specify that writer must generate Code128 barcode   
		writer.Settings.Barcode = BarcodeType.Code128   
   
		' set value items   
		writer.Settings.ValueItems = New ValueItemBase() {part1, part2, part3}   
   
		' generate image with barcode   
		Return writer.GetBarcodeAsBitmap()   
	End Function   
   
End Class
using System;
using System.Drawing;
            
using Vintasoft.Barcode;
using Vintasoft.Barcode.BarcodeInfo;
            
/// <summary>
/// Test that shows how to create an image with Code128 barcode with multiple value items.
/// </summary>
class Code128ValueItemExample
{
            
    /// <summary>
    /// Runs the test.
    /// </summary>
    public static void TestWriteBCBModes()
    {
        // create image with barcode
        using (Bitmap barcodeImage = WriteBCBModes("ABC", "12345678", "1234ABC"))
        {
            // create the barcode reader
            using (BarcodeReader reader = new BarcodeReader())
            {
                // specify that reader must search for Code128 barcodes only
                reader.Settings.ScanBarcodeTypes = BarcodeType.Code128;
            
                // read barcode from image
                IBarcodeInfo barcodeInfo = reader.ReadBarcodes(barcodeImage)[0];
            
                // print barcode value
                Console.WriteLine("Value = {0}", barcodeInfo.Value);
                // print value items
                Console.WriteLine("ValueItems:");
                foreach (Code128ValueItem item in barcodeInfo.ValueItems)
                    Console.WriteLine("[{0}] {1}", item.Mode, item.Value);
            }
        }
    }
    
    /// <summary>
    /// Writes the Code128 barcode in B, C, B modes.
    /// </summary>
    public static Bitmap WriteBCBModes(string part1B, string part2C, string part3B)
    {
        // create value items
            
        Code128ValueItem part1 = new Code128ValueItem(part1B, Code128EncodingMode.ModeB);
        Code128ValueItem part2 = new Code128ValueItem(part2C, Code128EncodingMode.ModeC);
        Code128ValueItem part3 = new Code128ValueItem(part3B, Code128EncodingMode.ModeB);
            
        // create the barcode writer
        BarcodeWriter writer = new BarcodeWriter();
            
        // specify that writer must generate Code128 barcode
        writer.Settings.Barcode = BarcodeType.Code128;
            
        // set value items
        writer.Settings.ValueItems = new ValueItemBase[] { part1, part2, part3 };
            
        // generate image with barcode
        return writer.GetBarcodeAsBitmap();
    }
            
}
Inheritance Hierarchy

System.Object
   Vintasoft.Barcode.BarcodeInfo.ValueItemBase
      Vintasoft.Barcode.BarcodeInfo.TextValueItem
         Vintasoft.Barcode.BarcodeInfo.Code128ValueItem

Requirements

Target Platforms: Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

See Also

Reference

Code128ValueItem Members
Vintasoft.Barcode.BarcodeInfo Namespace