Hello. I am developing a system in Windows Form, where there will be a report and a field will be a barcode. The problem is that when I pass the numeral 123456789 through the bar code parameter, it is created, but I can't read the code at all. I read on various forums how to do the calculation. But I can't implement it at all. Where am I going wrong?
public string ReturnCode128(string text) { const int codetype = 105; string textcode = text.Trim(); int quantidade = textcode.Length; int[] arrayintcode = new int[quantidade]; for(int i = 0; i < quantidade; i++) { char valToConvertToASCII = Convert.ToChar(textcode[i]); int valToMultiply = valToConvertToASCII- 32; arrayintcode[i] = valToMultiply; } string[] codemulti = new string[quantidade + 3]; codemulti[0] = codetype.ToString(); for(int i = 1; i < quantidade+1; i++) { codemulti[i] = (i*arrayintcode[i-1]).ToString(); } int value = 0; for(int i = 0; i < codemulti.Count(); i++) { value += Convert.ToInt32(codemulti[i]); } int module = value % codetype; char charverify = (char)(module + 32); char start = (char)186; char stop = (char)186; return $"{start}{textcode}{charverify}{stop}"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)