Click here to Skip to main content
15,899,556 members
Home / Discussions / C#
   

C#

 
GeneralRe: Microsoft .NET parser C# error ? Pin
Anonymous22-Dec-03 23:48
Anonymous22-Dec-03 23:48 
GeneralRe: Microsoft .NET parser C# error ? Pin
Member 26118822-Dec-03 23:48
Member 26118822-Dec-03 23:48 
GeneralRe: Microsoft .NET parser C# error ? Pin
identy6-Jan-04 9:53
identy6-Jan-04 9:53 
GeneralString Alignment Question Pin
RB@Emphasys22-Dec-03 8:18
RB@Emphasys22-Dec-03 8:18 
GeneralRe: String Alignment Question Pin
leppie22-Dec-03 9:57
leppie22-Dec-03 9:57 
GeneralRe: String Alignment Question Pin
Heath Stewart22-Dec-03 11:10
protectorHeath Stewart22-Dec-03 11:10 
GeneralRe: String Alignment Question Pin
RB@Emphasys29-Dec-03 3:07
RB@Emphasys29-Dec-03 3:07 
GeneralRe: String Alignment Question Pin
Heath Stewart29-Dec-03 3:56
protectorHeath Stewart29-Dec-03 3:56 
The font doesn't matter with String.Format - it's about the number of characters. The code fragment I gave you also uses your original code plus the suggestion before mine (using the negative operator, which was a correct solution) to yield better coding. As I stated - never concatenate strings so hap-hazardly! The code I gave merely was a solution to your concatenation snaffu.

The problem you're having is two-fold: String.Format - and the format specifiers that the previous guy mentions - align text up to the amount specified. Any more than that and the rest of the string is pushed over to make room for larger strings. If you don't mind this string being cut off, you'll have to trim it before using String.Format.

The second problem does have to do with the font and your word alignment (the first statement I made above about the font was in relation to character alignment). If you're not using a fixed-width font, you won't be able to get the text to line up because the sum of the widths of each character will most likely be different for each line. If you really need to line up your text, consider using a ListView.

If you're doing this for a console app, you'd be a fool to use a nothing but a fixed-width font for your console window (specifying a font in the app - at least for now - won't do anything). Most utilities rely on using a fixed-width font to format their output.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
QuestionStatic destructor? Pin
CBoland22-Dec-03 6:07
CBoland22-Dec-03 6:07 
AnswerRe: Static destructor? Pin
leppie22-Dec-03 6:38
leppie22-Dec-03 6:38 
GeneralRe: Static destructor? Pin
CBoland22-Dec-03 7:04
CBoland22-Dec-03 7:04 
GeneralString tokenizer in C# Pin
dabs22-Dec-03 5:37
dabs22-Dec-03 5:37 
GeneralRe: String tokenizer in C# Pin
leppie22-Dec-03 6:35
leppie22-Dec-03 6:35 
GeneralRe: String tokenizer in C# Pin
Larry Antram22-Dec-03 11:51
Larry Antram22-Dec-03 11:51 
GeneralC# API to generate PDF files from XSL:FO Pin
MrEyes22-Dec-03 4:21
MrEyes22-Dec-03 4:21 
GeneralRe: C# API to generate PDF files from XSL:FO Pin
Philip Fitzsimons22-Dec-03 4:37
Philip Fitzsimons22-Dec-03 4:37 
GeneralRe: C# API to generate PDF files from XSL:FO Pin
MrEyes22-Dec-03 5:17
MrEyes22-Dec-03 5:17 
Generalglobal variable in c# Pin
Anonymous22-Dec-03 4:06
Anonymous22-Dec-03 4:06 
GeneralRe: global variable in c# Pin
ThoWeib22-Dec-03 4:28
ThoWeib22-Dec-03 4:28 
GeneralRe: global variable in c# Pin
Heath Stewart22-Dec-03 4:30
protectorHeath Stewart22-Dec-03 4:30 
GeneralConfiguration file Pin
Mazdak22-Dec-03 3:31
Mazdak22-Dec-03 3:31 
GeneralRe: Configuration file Pin
Heath Stewart22-Dec-03 4:26
protectorHeath Stewart22-Dec-03 4:26 
QuestionRegistry or Special Folders? Pin
Ken Galer22-Dec-03 3:25
Ken Galer22-Dec-03 3:25 
AnswerRe: Registry or Special Folders? Pin
Heath Stewart22-Dec-03 4:21
protectorHeath Stewart22-Dec-03 4:21 
Generalkeyboard event listener Pin
hazzem elrefai22-Dec-03 1:48
hazzem elrefai22-Dec-03 1:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.