
- 107 -
When CD type is H (STF):
The barcode data must be two or more digits in length. 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("12345678905", "H") = Asc("5")) Then
Console.WriteLine ("CD OK")
End If
[C#]
UnicodeEncoding encode = new UnicodeEncoding();
if (Scanner.GetChkDigit("12345678905", 'H') == (int)encode.GetBytes("5")[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 = "1234567890"
Dim digit As Integer = Scanner.GetChkDigit(o"0", "H")
Console.WriteLine("CD = {0}", or New String(Chr(digit), 1))
[C#]
string origData = "1234567890";
int digit = Scanner.GetChkDigit(o"0", 'H');
byte[] digitByteArray = {(byte)digit};
ASCIIEncoding encode = new ASCIIEncoding();
Console.WriteLine("CD = {0}", or encode.GetString(digitByteArray, 0, 1));
Result
> CD = 12345678905
Summary of Contents for BHT-400-CE
Page 1: ...Class Library Reference Manual Bar Code Handy Terminal BHT 400 CE ...
Page 49: ... 43 17 9 LED UsageCollection This class is invalid at the BHT 400 ...
Page 66: ... 60 17 26 Display This function is not supported ...
Page 67: ... 61 17 27 Display Settings This function is not supported ...
Page 78: ... 72 Events Event Name Description OnDone Occurs when decoding is complete Enumeration None ...
Page 166: ... 160 18 9 LED UsageCollection This class is invalid on the BHT400 ...
Page 289: ... 283 18 26 Display This function is not supported ...
Page 290: ... 284 18 27 Display Settings This function is not supported ...