Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > String Alignment problem

Reply
Thread Tools

String Alignment problem

 
 
Rahul
Guest
Posts: n/a
 
      06-04-2007
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

 
Reply With Quote
 
 
 
 
GeezerButler
Guest
Posts: n/a
 
      06-04-2007
On Jun 4, 10:08 am, Rahul <(E-Mail Removed)> wrote:
> 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?

 
Reply With Quote
 
 
 
 
Rahul
Guest
Posts: n/a
 
      06-04-2007
On Jun 4, 10:38 am, GeezerButler <(E-Mail Removed)> wrote:
> On Jun 4, 10:08 am, Rahul <(E-Mail Removed)> wrote:
>
>
>
>
>
> > 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

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-04-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
>



 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      06-04-2007
On Jun 4, 8:08 am, Rahul <(E-Mail Removed)> wrote:
> On Jun 4, 10:38 am, GeezerButler <(E-Mail Removed)> wrote:
> 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

 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      06-04-2007
On Jun 4, 9:02 am, "Eliyahu Goldin"
<(E-Mail Removed)> wrote:
> 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.

 
Reply With Quote
 
GeezerButler
Guest
Posts: n/a
 
      06-04-2007
On Jun 4, 11:08 am, Rahul <(E-Mail Removed)> wrote:
> On Jun 4, 10:38 am, GeezerButler <(E-Mail Removed)> wrote:
>
>
>
>
>
> > On Jun 4, 10:08 am, Rahul <(E-Mail Removed)> wrote:

>
> > > 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.

 
Reply With Quote
 
Rahul
Guest
Posts: n/a
 
      06-04-2007
On Jun 4, 12:13 pm, GeezerButler <(E-Mail Removed)> wrote:
> On Jun 4, 11:08 am, Rahul <(E-Mail Removed)> wrote:
>
>
>
>
>
> > On Jun 4, 10:38 am, GeezerButler <(E-Mail Removed)> wrote:

>
> > > On Jun 4, 10:08 am, Rahul <(E-Mail Removed)> wrote:

>
> > > > 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

 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      06-04-2007
On Jun 4, 9:27 am, Rahul <(E-Mail Removed)> wrote:
> 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}", ...

 
Reply With Quote
 
Rahul
Guest
Posts: n/a
 
      06-04-2007
On Jun 4, 12:10 pm, Alexey Smirnov <(E-Mail Removed)> wrote:
> On Jun 4, 8:08 am, Rahul <(E-Mail Removed)> wrote:> On Jun 4, 10:38 am, GeezerButler <(E-Mail Removed)> wrote:
>
> > 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())

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem w/ Text Alignment - IE7 Problem Only Mtmartin71 HTML 9 08-28-2007 06:31 AM
asp:panel alignment problem Gary Coutts ASP .Net 1 02-11-2006 11:24 PM
String matching and alignment? Bryan Perl Misc 4 06-10-2004 01:50 AM
Alignment problem in the datagrid Vannela ASP .Net 2 12-16-2003 05:26 AM
Re: Help required for alignment problem Sunil Menon ASP .Net 0 06-26-2003 07:56 AM



Advertisments