Denso BHT-200QW Dokumentacja Strona 135

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 377
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 134
- 133 -
When CD type is
M (Code 39):
The barcode data must be two or more digits in length, excluding the start and stop
characters. Otherwise,
this function returns "0" and throws an exception.
To check whether the CD is correct, pass a piece of barcode data with a CD to the
Scanner.GetChkDigit method as shown below. If the returned value is equal to the CD,
then the CD is correct.
[VB]
If (Scanner.GetChkDigit("CODE39W", "M") = Asc("W")) Then
Console.WriteLine ("CD OK")
End If
[C#]
UnicodeEncoding encode = new UnicodeEncoding();
if (Scanner.GetChkDigit("CODE39W", 'M') == (int)encode.GetBytes("W")[0]) {
Console.WriteLine ("CD OK");
}
To append a CD to barcode data, pass a piece of barcode data with a dummy character
appended to the Scanner.GetChkDigit method as shown below. The returned value will be
the CD. Replace the dummy character with the returned value.
[VB]
Dim origData As String = "CODE39"
Dim digit As Integer = Scanner.GetChkDigit(origData+"0", "M")
Console.WriteLine("CD = {0}", origData + New String(Chr(digit), 1))
[C#]
string origData = "CODE39";
int digit = Scanner.GetChkDigit(origData+"0", 'M');
byte[] digitByteArray = {(byte)digit};
ASCIIEncoding encode = new ASCIIEncoding();
Console.WriteLine("CD = {0}", origData + encode.GetString(digitByteArray, 0, 1));
Result
> CD = CODE39W
Przeglądanie stron 134
1 2 ... 130 131 132 133 134 135 136 137 138 139 140 ... 376 377

Komentarze do niniejszej Instrukcji

Brak uwag