Solved

Right justify text field, vb.net

Posted on 2007-03-27
2
915 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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

734 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