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
Bill Az
NA
15
0
Need help with String.Format arguments
Nov 8 2009 5:59 PM
I am trying to implement the ability for users to specify which string fields will appear in an invoice richtextbox and what order they will appear in the line of text. This string is an invoice line and there can be multiple lines so the formatting needs to also specify field widths for alignment.
I am trying to use String.Format so I can pass the filed position and format specifiers (as shown below) but am just totally stuck as how to pass the field name parameters since the order and number of fields will vary.
I have 10 fields so the user can select from 1 to 10 of the fields and then specify the order they want them to appear.
The end result String.Format call needs to look something like this.
// format specifer info: {field_number, width/alignment}
String.Format("{0,-10}, {1,-35}{2,-10}", sDate, sDesc, sPrice);
or this...
String.Format("{0,-10}, {1,-10}{2,-35}", sDate, sPrice, sDesc);
or this
String.Format("{0,-10}, {1,-10}{2,-35}{3,-15}{4,-10}", sDate, sPrice, sDesc, sSalesman, sAcct);
or any other combination of fields and field order.
I have the code to build the formattting specifier all done, but....
I am at a loss on how to build and pass the list of my string variable names.
I bet this is something so stupid, but I give up. I have been overthinking this.
I appreciate any help, assistance, etc....
Reply
Answers (
8
)
Problem in using webpartmanager control
Add records on button click