text file format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to create a text file which I can get working but i need it to be in
this format which I'm close but not exactly there yet.

format I need:
1234569 BMW
1253252Mercedes
9876522 Lexus
9858252 Jaguar

I'm getting this format:
1234569 BMW
1253252 Mercedes
9876522 Lexus
9858252 Jaguar

here is my code I'm using to write the lines in the text file
string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
file.WriteFile(CarSales);

am I missing something?
 
I got it working I removed the (-) sign.

instead of this:
string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
i did this:
string CarSales = string.Format("{0,9}{1,8}", VINNumber, CarMake);
and now the file lines up correctly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

grid format question 1
text file read 2
subheaders with totals for each 3
get cell value within gridview 14
add space in string 4
formatting question 7
adding to an arraylist 3
file feed 4

Back
Top