Friends,

My Problem is related to writing a text file from a database
using .Net. in a particular string format.
I have a dataset with a table, let suppose in this table there are
three fields.
- Code
- Description
- Amount

At the time of writing a text file I use in a for loop -

String.Format("{0,10}{1, 40} {2,-10}", DS.Table(0).Row(i)
("Code").ToString(), DS.Table(0).Row(i)("Description").ToString(),
DS.Table(0).Row(i)("Amount").ToString())


But the problem is related to the alignment. Data comes like in
following format:

01Code 01Desc 2000
02Code 02Desc 3000
03CodeABC 03Desc 4000
04xyz 04Desc 5000


I want Data comes in following proper alignment format.

01Code 01Desc 2000
02Code 02Desc 3000
03CodeABC 03Desc 4000
04xyz 04Desc 5000


So anybody knows the solutions of this problem, please and please
reply imediately, its urgent.



Rahul

Re: String Alignment problem by Bryan

Bryan
Tue Jun 05 20:40:57 CDT 2007

Are you using a fixed-width font?

--
Bryan Phillips
MCT, MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
Web Site: http://www.composablesystems.net



"Rahul" <verma.career@gmail.com> wrote in message
news:1180933649.753629.193350@r19g2000prf.googlegroups.com:

> Friends,
>
> My Problem is related to writing a text file from a database
> using .Net. in a particular string format.
> I have a dataset with a table, let suppose in this table there are
> three fields.
> - Code
> - Description
> - Amount
>
> At the time of writing a text file I use in a for loop -
>
> String.Format("{0,10}{1, 40} {2,-10}", DS.Table(0).Row(i)
> ("Code").ToString(), DS.Table(0).Row(i)("Description").ToString(),
> DS.Table(0).Row(i)("Amount").ToString())
>
>
> But the problem is related to the alignment. Data comes like in
> following format:
>
> 01Code 01Desc 2000
> 02Code 02Desc 3000
> 03CodeABC 03Desc 4000
> 04xyz 04Desc 5000
>
>
> I want Data comes in following proper alignment format.
>
> 01Code 01Desc 2000
> 02Code 02Desc 3000
> 03CodeABC 03Desc 4000
> 04xyz 04Desc 5000
>
>
> So anybody knows the solutions of this problem, please and please
> reply imediately, its urgent.
>
>
>
> Rahul