By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,684 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,684 IT Pros & Developers. It's quick & easy.

String Alignment problem

P: n/a
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

Jun 4 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Jun 4, 10:08 am, Rahul <verma.car...@gmail.comwrote:
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
For the formatting option that you have your output will be like:
01Code 01Desc2000
and not
01Code 01Desc 2000

Also, some of the strings may not be getting formatted properly if
length of any string in your dataset exceeds the width that you
specify in the format option.
Can you show me with your real data?

Jun 4 '07 #2

P: n/a
On Jun 4, 10:38 am, GeezerButler <kurtr...@gmail.comwrote:
On Jun 4, 10:08 am, Rahul <verma.car...@gmail.comwrote:


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

For the formatting option that you have your output will be like:
01Code 01Desc2000
and not
01Code 01Desc 2000

Also, some of the strings may not be getting formatted properly if
length of any string in your dataset exceeds the width that you
specify in the format option.
Can you show me with your real data?- Hide quoted text -

- Show quoted text -
thanks for reply
I have put '-' on the place of space for better understanding.
This comes for Northwind database, product table
the real data is :

alice mutton----------------------------alice mutton

aniseed syrup---------------------------aniseed syrup

boston crab meat------------------------boston crab meat

camembert pierrot-----------------------camembert pierrot

carnarvon tigers------------------------carnarvon tigers

chai------------------------------------chai

chang-----------------------------------chang

chartreuse verte------------------------chartreuse verte

chef anton's cajun seasoning------------chef anton's cajun seasoning

chef anton's gumbo mix------------------chef anton's gumbo mix

chocolade-------------------------------chocolade

côte de blaye---------------------------côte de blaye

escargots de bourgogne------------------escargots de bourgogne

filo mix--------------------------------filo mix

flotemysost-----------------------------flotemysost

geitost---------------------------------geitost

genen shouyu----------------------------genen shouyu

gnocchi di nonna alice------------------gnocchi di nonna alice

gorgonzola telino-----------------------gorgonzola telino

grandma's boysenberry spread------------grandma's boysenberry spread

gravad lax------------------------------gravad lax

guaraná fantástica----------------------guaraná fantástica

gudbrandsdalsost------------------------gudbrandsdalsost

gula malacca----------------------------gula malacca

gumbär gummibärchen---------------------gumbär gummibärchen

gustaf's knäckebröd---------------------gustaf's knäckebröd

ikura-----------------------------------ikura

inlagd sill-----------------------------inlagd sill

ipoh coffee-----------------------------ipoh coffee

jack's new england clam chowder---------jack's new england clam
chowder

konbu-----------------------------------konbu

lakkalikööri----------------------------lakkalikööri

laughing lumberjack lager---------------laughing lumberjack lager

longlife tofu---------------------------longlife tofu

louisiana fiery hot pepper sauce--------louisiana fiery hot pepper
sauce

louisiana hot spiced okra---------------louisiana hot spiced okra

manjimup dried apples-------------------manjimup dried apples

mascarpone fabioli----------------------mascarpone fabioli

maxilaku--------------------------------maxilaku

mishi kobe niku-------------------------mishi kobe niku

mozzarella di giovanni------------------mozzarella di giovanni

nord-ost matjeshering-------------------nord-ost matjeshering

northwoods cranberry sauce--------------northwoods cranberry sauce

nunuca nuß-nougat-creme-----------------nunuca nuß-nougat-creme

original frankfurter grüne soße---------original frankfurter grüne
soße

outback lager---------------------------outback lager

pâté chinois----------------------------pâté chinois

pavlova---------------------------------pavlova

perth pasties---------------------------perth pasties

queso cabrales--------------------------queso cabrales

queso manchego la pastora---------------queso manchego la pastora

raclette courdavault--------------------raclette courdavault

ravioli angelo--------------------------ravioli angelo

rhönbräu klosterbier--------------------rhönbräu klosterbier

röd kaviar------------------------------röd kaviar

rogede sild-----------------------------rogede sild

rössle sauerkraut-----------------------rössle sauerkraut

sasquatch ale---------------------------sasquatch ale

schoggi schokolade----------------------schoggi schokolade

scottish longbreads---------------------scottish longbreads

singaporean hokkien fried mee-----------singaporean hokkien fried mee

sir rodney's marmalade------------------sir rodney's marmalade

sir rodney's scones---------------------sir rodney's scones

sirop d'érable--------------------------sirop d'érable

spegesild-------------------------------spegesild

steeleye stout--------------------------steeleye stout

tarte au sucre--------------------------tarte au sucre

teatime chocolate biscuits--------------teatime chocolate biscuits

thüringer rostbratwurst-----------------thüringer rostbratwurst

tofu------------------------------------tofu

tourtière-------------------------------tourtière

tunnbröd--------------------------------tunnbröd

uncle bob's organic dried pears---------uncle bob's organic dried
pears

valkoinen suklaa------------------------valkoinen suklaa

vegie-spread----------------------------vegie-spread

wimmers gute semmelknödel---------------wimmers gute semmelknödel

zaanse koeken---------------------------zaanse koeken
Rahul

Jun 4 '07 #3

P: n/a
You should organize the output into a table with 3 columns. The easiest way
is to use GridView control databound to your dataset.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Rahul" <ve**********@gmail.comwrote in message
news:11**********************@j4g2000prf.googlegro ups.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

Jun 4 '07 #4

P: n/a
On Jun 4, 8:08 am, Rahul <verma.car...@gmail.comwrote:
On Jun 4, 10:38 am, GeezerButler <kurtr...@gmail.comwrote:
01Code 01Desc 2000
Also, some of the strings may not be getting formatted properly if
length of any string in your dataset exceeds the width that you
specify in the format option.
Can you show me with your real data?- Hide quoted text -

thanks for reply
I have put '-' on the place of space for better understanding.
This comes for Northwind database, product table
I think it's because of the size of the strings.

When you have

String.Format("{0,10}....

it does mean the length of the Code-field cannot be more than 10
characters, in other case it would shift the whole line.

Try to change

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

I think it should help

Jun 4 '07 #5

P: n/a
On Jun 4, 9:02 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
You should organize the output into a table with 3 columns. The easiest way
is to use GridView control databound to your dataset.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
He is writing a text file.

Jun 4 '07 #6

P: n/a
On Jun 4, 11:08 am, Rahul <ve**********@gmail.comwrote:
On Jun 4, 10:38 am, GeezerButler <kurtr...@gmail.comwrote:


On Jun 4, 10:08 am, Rahul <verma.car...@gmail.comwrote:
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
For the formatting option that you have your output will be like:
01Code 01Desc2000
and not
01Code 01Desc 2000
Also, some of the strings may not be getting formatted properly if
length of any string in your dataset exceeds the width that you
specify in the format option.
Can you show me with your real data?- Hide quoted text -
- Show quoted text -

thanks for reply
I have put '-' on the place of space for better understanding.
This comes for Northwind database, product table
the real data is :

alice mutton----------------------------alice mutton

aniseed syrup---------------------------aniseed syrup

boston crab meat------------------------boston crab meat

camembert pierrot-----------------------camembert pierrot

carnarvon tigers------------------------carnarvon tigers

chai------------------------------------chai

chang-----------------------------------chang

chartreuse verte------------------------chartreuse verte

chef anton's cajun seasoning------------chef anton's cajun seasoning

chef anton's gumbo mix------------------chef anton's gumbo mix

chocolade-------------------------------chocolade

côte de blaye---------------------------côte de blaye

escargots de bourgogne------------------escargots de bourgogne

filo mix--------------------------------filo mix

flotemysost-----------------------------flotemysost

geitost---------------------------------geitost

genen shouyu----------------------------genen shouyu

gnocchi di nonna alice------------------gnocchi di nonna alice

gorgonzola telino-----------------------gorgonzola telino

grandma's boysenberry spread------------grandma's boysenberry spread

gravad lax------------------------------gravad lax

guaraná fantástica----------------------guaraná fantástica

gudbrandsdalsost------------------------gudbrandsdalsost

gula malacca----------------------------gula malacca

gumbär gummibärchen---------------------gumbär gummibärchen

gustaf's knäckebröd---------------------gustaf's knäckebröd

ikura-----------------------------------ikura

inlagd sill-----------------------------inlagd sill

ipoh coffee-----------------------------ipoh coffee

jack's new england clam chowder---------jack's new england clam
chowder

konbu-----------------------------------konbu

lakkalikööri----------------------------lakkalikööri

laughing lumberjack lager---------------laughing lumberjack lager

longlife tofu---------------------------longlife tofu

louisiana fiery hot pepper sauce--------louisiana fiery hot pepper
sauce

louisiana hot spiced okra---------------louisiana hot spiced okra

manjimup dried apples-------------------manjimup dried apples

mascarpone fabioli----------------------mascarpone fabioli

maxilaku--------------------------------maxilaku

mishi kobe niku-------------------------mishi kobe niku

mozzarella di giovanni------------------mozzarella di giovanni

nord-ost matjeshering-------------------nord-ost matjeshering

northwoods cranberry sauce--------------northwoods cranberry sauce

nunuca nuß-nougat-creme-----------------nunuca nuß-nougat-creme

original frankfurter grüne soße---------original frankfurter grüne
soße

outback lager---------------------------outback lager

pâté chinois----------------------------pâté chinois

pavlova---------------------------------pavlova

perth pasties---------------------------perth pasties

queso cabrales--------------------------queso cabrales

queso manchego la pastora---------------queso manchego la pastora

raclette courdavault--------------------raclette courdavault

ravioli angelo--------------------------ravioli angelo

rhönbräu klosterbier--------------------rhönbräu klosterbier

röd kaviar------------------------------röd kaviar

rogede sild-----------------------------rogede sild

rössle sauerkraut-----------------------rössle sauerkraut

sasquatch ale---------------------------sasquatch ale

schoggi schokolade----------------------schoggi schokolade

scottish longbreads---------------------scottish longbreads

singaporean hokkien fried mee-----------singaporean hokkien fried mee

sir rodney's marmalade------------------sir rodney's marmalade

sir rodney's scones---------------------sir rodney's scones

sirop d'érable--------------------------sirop d'érable

spegesild-------------------------------spegesild

steeleye stout--------------------------steeleye stout

tarte au sucre--------------------------tarte au sucre

teatime chocolate biscuits--------------teatime chocolate biscuits

thüringer rostbratwurst-----------------thüringer rostbratwurst

tofu------------------------------------tofu

tourtière-------------------------------tourtière

tunnbröd--------------------------------tunnbröd

uncle bob's organic dried pears---------uncle bob's organic dried
pears

valkoinen suklaa------------------------valkoinen suklaa

vegie-spread----------------------------vegie-spread

wimmers gute semmelknödel---------------wimmers gute semmelknödel

zaanse koeken---------------------------zaanse koeken

Rahul- Hide quoted text -

- Show quoted text -
Are you writing this to a text file or a web page?
If you copy paste all the data you posted in the post above to
textpad, you'll see that it is correctly formatted.
But the same data does not look ok on a web page like this one,
because the fonts are not monospaced ( i think).
If you are writing to a web page then follow Eliyahu's advice and bind
it to some table.

Jun 4 '07 #7

P: n/a
On Jun 4, 12:13 pm, GeezerButler <kurtr...@gmail.comwrote:
On Jun 4, 11:08 am, Rahul <verma.car...@gmail.comwrote:


On Jun 4, 10:38 am, GeezerButler <kurtr...@gmail.comwrote:
On Jun 4, 10:08 am, Rahul <verma.car...@gmail.comwrote:
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
For the formatting option that you have your output will be like:
01Code 01Desc2000
and not
01Code 01Desc 2000
Also, some of the strings may not be getting formatted properly if
length of any string in your dataset exceeds the width that you
specify in the format option.
Can you show me with your real data?- Hide quoted text -
- Show quoted text -
thanks for reply
I have put '-' on the place of space for better understanding.
This comes for Northwind database, product table
the real data is :
alice mutton----------------------------alice mutton
aniseed syrup---------------------------aniseed syrup
boston crab meat------------------------boston crab meat
camembert pierrot-----------------------camembert pierrot
carnarvon tigers------------------------carnarvon tigers
chai------------------------------------chai
chang-----------------------------------chang
chartreuse verte------------------------chartreuse verte
chef anton's cajun seasoning------------chef anton's cajun seasoning
chef anton's gumbo mix------------------chef anton's gumbo mix
chocolade-------------------------------chocolade
côte de blaye---------------------------côte de blaye
escargots de bourgogne------------------escargots de bourgogne
filo mix--------------------------------filo mix
flotemysost-----------------------------flotemysost
geitost---------------------------------geitost
genen shouyu----------------------------genen shouyu
gnocchi di nonna alice------------------gnocchi di nonna alice
gorgonzola telino-----------------------gorgonzola telino
grandma's boysenberry spread------------grandma's boysenberry spread
gravad lax------------------------------gravad lax
guaraná fantástica----------------------guaraná fantástica
gudbrandsdalsost------------------------gudbrandsdalsost
gula malacca----------------------------gula malacca
gumbär gummibärchen---------------------gumbär gummibärchen
gustaf's knäckebröd---------------------gustaf's knäckebröd
ikura-----------------------------------ikura
inlagd sill-----------------------------inlagd sill
ipoh coffee-----------------------------ipoh coffee
jack's new england clam chowder---------jack's new england clam
chowder
konbu-----------------------------------konbu
lakkalikööri----------------------------lakkalikööri
laughing lumberjack lager---------------laughing lumberjack lager
longlife tofu---------------------------longlife tofu
louisiana fiery hot pepper sauce--------louisiana fiery hot pepper
sauce
louisiana hot spiced okra---------------louisiana hot spiced okra
manjimup dried apples-------------------manjimup dried apples
mascarpone fabioli----------------------mascarpone fabioli
maxilaku--------------------------------maxilaku
mishi kobe niku-------------------------mishi kobe niku
mozzarella di giovanni------------------mozzarella di giovanni
nord-ost matjeshering-------------------nord-ost matjeshering
northwoods cranberry sauce--------------northwoods cranberry sauce
nunuca nuß-nougat-creme-----------------nunuca nuß-nougat-creme
original frankfurter grüne soße---------original frankfurter grüne
soße
outback lager---------------------------outback lager
pâté chinois----------------------------pâté chinois
pavlova---------------------------------pavlova
perth pasties---------------------------perth pasties
queso cabrales--------------------------queso cabrales
queso manchego la pastora---------------queso manchego la pastora
raclette courdavault--------------------raclette courdavault
ravioli angelo--------------------------ravioli angelo
rhönbräu klosterbier--------------------rhönbräu klosterbier
röd kaviar------------------------------röd kaviar
rogede sild-----------------------------rogede sild
rössle sauerkraut-----------------------rössle sauerkraut
sasquatch ale---------------------------sasquatch ale
schoggi schokolade----------------------schoggi schokolade
scottish longbreads---------------------scottish longbreads
singaporean hokkien fried mee-----------singaporean hokkien fried mee
sir rodney's marmalade------------------sir rodney's marmalade
sir rodney's scones---------------------sir rodney's scones
sirop d'érable--------------------------sirop d'érable
spegesild-------------------------------spegesild
steeleye stout--------------------------steeleye stout
tarte au sucre--------------------------tarte au sucre
teatime chocolate biscuits--------------teatime chocolate biscuits
thüringer rostbratwurst-----------------thüringer rostbratwurst
tofu------------------------------------tofu
tourtière-------------------------------tourtière
tunnbröd--------------------------------tunnbröd
uncle bob's organic dried pears---------uncle bob's organic dried
pears
valkoinen suklaa------------------------valkoinen suklaa
vegie-spread----------------------------vegie-spread
wimmers gute semmelknödel---------------wimmers gute semmelknödel
zaanse koeken---------------------------zaanse koeken
Rahul- Hide quoted text -
- Show quoted text -

Are you writing this to a text file or a web page?
If you copy paste all the data you posted in the post above to
textpad, you'll see that it is correctly formatted.
But the same data does not look ok on a web page like this one,
because the fonts are not monospaced ( i think).
If you are writing to a web page then follow Eliyahu's advice and bind
it to some table.- Hide quoted text -

- Show quoted text -
Hi ,

I am writing in a simple text file.
here i use '-' character on the place of a single space.

Rahul

Jun 4 '07 #8

P: n/a
On Jun 4, 9:27 am, Rahul <verma.car...@gmail.comwrote:
Hi ,

I am writing in a simple text file.
here i use '-' character on the place of a single space.

Rahul- Hide quoted text -

- Show quoted text -
If you don't really need a text to be right aligned, you can try to
use a tab

e.g.

String.Format("{0}" & vbTab & "{1}" & vbTab & "{2}", ...

Jun 4 '07 #9

P: n/a
On Jun 4, 12:10 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 4, 8:08 am, Rahul <verma.car...@gmail.comwrote:On Jun 4, 10:38 am, GeezerButler <kurtr...@gmail.comwrote:
01Code 01Desc 2000


Also, some of the strings may not be getting formatted properly if
length of any string in your dataset exceeds the width that you
specify in the format option.
Can you show me with your real data?- Hide quoted text -
thanks for reply
I have put '-' on the place of space for better understanding.
This comes for Northwind database, product table

I think it's because of the size of the strings.

When you have

String.Format("{0,10}....

it does mean the length of the Code-field cannot be more than 10
characters, in other case it would shift the whole line.

Try to change

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

I think it should help
Hi,

I have try it, but not working, and output is same

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

Jun 4 '07 #10

P: n/a
On Jun 4, 9:35 am, Rahul <verma.car...@gmail.comwrote:
Hi,

I have try it, but not working, and output is same

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

- Show quoted text -
Where do you open the file?

The text output must be viewed (or printed) with a fixed-width font in
order to see the correct result. If you use Notepad, click Format -
Font, and select a fixed-width font, for example, Courier.

The code to check

<%@ Import Namespace="System.IO" %>
<script language="vb" runat="server">
sub Page_Load(sender as Object, e as EventArgs)

Dim sw As System.IO.StreamWriter = New
System.IO.StreamWriter(Server.MapPath("test.txt"))
sw.WriteLine(String.Format("{0,10}{1, 40} {2,-10}", _
Left("123", 10), _
Left("123", 40), _
"123"))
sw.WriteLine(String.Format("{0,10}{1, 40} {2,-10}", _
Left("1234567890123456789", 10), _
Left("123", 40), _
"123"))
sw.WriteLine(String.Format("{0,10}{1, 40} {2,-10}", _
Left("12345", 10), _
Left("12345", 40), _
"12345"))
sw.Close()

end sub
</script>

Jun 4 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.