I'm currently writing a application that ultimately outputs a configuration file as a text document. The question I have is how do I format the text so it looks like this: (I've used periods to show where I need spaces because I can't format it correctly in the message!)


host_name.....................CF1
alias.............................reception
address........................127.0.0.1
check_command.............check-host-alive


I've created a structure for all the parameters and hold these in a seperate collection. Basically what I'm thinking of doing is creating the whole file as one large string and then letting the user preview the config file in a mulitline textbox before writing it out to disk.

Question is how can I format the string so the text aligns correctly, adding spaces doesn't seem to work ?