Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, everyone!

I always have this problem.

public String ReadBarcode(Bitmap img)
{
String imagebarcode = "";
imagebarcode = BarcodeImaging.ReadCode39(img, false, Color.Yellow);
return imagebarcode;
}

with this code I got the Exception:

der Index und die Anzahl müssen sich auf eine Position in der Zeichenfolge beziehen. Parameter:SourceIndex
C#
the index and the number must refer to a location within the string.

How can give me a advice, how to fix this problem.
Posted
Comments
phil.o 9-Dec-15 5:32am    
Please show the line which is throwing the exception; nothing in the code snippet you provided is performing an index-based access to a string.
You can use the stack trace of the exception to know which line :)
Member 12075208 9-Dec-15 8:05am    
this line
imagebarcode = BarcodeImaging.ReadCode39(img, false, Color.Yellow);
phil.o 9-Dec-15 8:08am    
There is no indexed access to a string in this line. Just an assignation to your variable from the ReadCode39 method.
You should put a breakpoint on this line and execute line-by-line from there to see where the problem appears.
Member 12075208 9-Dec-15 8:19am    
I don't have the code of ReadCode39, I just have the Barcodeimaging dll file
phil.o 9-Dec-15 8:24am    
Then what is the value of the imagebarcode variable after assignation?
And where else do you use this value? The error message you give does not match the code block you show.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900