Solved

Right justify text field, vb.net

Posted on 2007-03-27
2
916 Views
Last Modified: 2013-11-26
Hi There,

I have a small app that drills into a database and displays the results in a datagrid. The user can then edit the records then save the results to a .txt file which is then e-mailed to a recipient.

The text file is formatted a certain way with some fields padded out and some fields truncated. However i need to right justify a couple of fields but cannot see a way of doing this. I am using vb.net 2003.

Many Thanks,
0
Comment
Question by:Baikie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 50 total points
ID: 18804262
Without seeing your code that saves the data to a text file it is hard to make recommendations.

As a generalization, you probably want String.PadLeft() and String.PadRight():
http://msdn2.microsoft.com/en-us/library/system.string.padleft.aspx
http://msdn2.microsoft.com/en-us/library/system.string.padright.aspx
0
 

Author Comment

by:Baikie
ID: 18806283
Hi,

thanks for the reply. I was just being stupid. The pad left would have the same functionality as right justify!

Ta.

Will give the points to you anyway for the reply!!

See ya
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question