TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Giovanbattista Barra
NA
98
18.8k
C# StringBuilder: How to manipulate a string into counter?
Feb 4 2019 5:04 AM
Dear Team,
I need to manipulate the following StringBuilder (from a ZPL Printer Code):
StringBuilder objectNumber = new StringBuilder("0001");
because I habe a GUI and on it there are 2 input fields:
- a StartObjectNumber (as integer instatiated), which starts from "0001"
- a EndObjectNumber (as integer instatiated), which for example ends with "9999"
that's why it must count from "0001" to "9999" so that the programm prints the following tickets:
"0001", "0002", "0003"
Question: shall I somehow convert objectNumber in integer? So that I can count from 0001 to 9999?
Here my code:
StringBuilder objectNumber = new StringBuilder("0001");
for (int i = BranchOffice.StartObjectNumber; i < BranchOffice.EndObjectNumber; i++)
{
ZPLString =
"^XA" +
"^PON" +
"^LH0,0" +
"^CI13^LRY" +
"^FT110,150^BY2^BCN,100,N,N,N^FD01000100010011^FS" +
"^FT70,230^A0N,60,60^FD01 0001 0001 " + objectNumber + "^FS" +
"^PR4" +
"^XZ";
byte[] sendBytes = Encoding.GetEncoding("Cp850").GetBytes(ZPLString);
stream.Write(sendBytes, 0, sendBytes.Length);
}
This code makes me
only print more tickets but the content "0001" doesnt change.
I would like to print more tickets as the programm already does but it must count from "0001" to "9999".
I hope you can help m3.
Thank you in advance
Reply
Answers (
2
)
what Difference between Hash(#) and temp(@) table in SQL?
Unable to View File