473,414 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Lining up data under titles

I'm trying to code something so that I can line up product information
under it's titles like so:

Product#: Qty Price Product Name
6666 1 7.5 Product2

Using the \t code in C# doesn't work because where it tabs to for each
line isn't always the same.

So I tried to pad spaces to each section and line them up that way.
So I would add 5 spaces to "Product#:" which brought it to 15, and so
on with the rest of the titles.

I then do the same thing with each line underneath the titles, adding
spaces to the product value until I get to 15 and so on with the
others.

So everything should line up I would think. But it doesn't, things
still are off ever so slightly.

Is there another way to code this that I'm just not seeing?
Nov 16 '05 #1
2 1144

"Doug" <dn******@dtgnet.com> wrote in message news:ff**************************@posting.google.c om...
I'm trying to code something so that I can line up product information
under it's titles like so:

Product#: Qty Price Product Name
6666 1 7.5 Product2

Using the \t code in C# doesn't work because where it tabs to for each
line isn't always the same.

So I tried to pad spaces to each section and line them up that way.
So I would add 5 spaces to "Product#:" which brought it to 15, and so
on with the rest of the titles.

I then do the same thing with each line underneath the titles, adding
spaces to the product value until I get to 15 and so on with the
others.

So everything should line up I would think. But it doesn't, things
still are off ever so slightly.

Is there another way to code this that I'm just not seeing?


What font are you using? If that's proportional (meaning the various
characters all have different sizes) then I think you will have to write
your own screenpainter.
Or you could use a fixed-width font ('Courier New' for example).

By the way, for those extra spaces you can use String.Format
to add spaces either to the left or to the right (you didn't specify
how you solved that..)
Hans Kesting
Nov 16 '05 #2
Hey there,
After I sent the first question I figured out the whole font thing
and we decided to go with Courier New which should alleviate some of
the issue. However, there's no guarantee that the email we send will
be recieved by the customer in Courier New because they can have their
email preferences set to receive it in any font they want. So I'm not
sure if that'll get me around the problem 100% completely. Do you
have any suggestions in that arena?

As far as how I'm adding the spaces, I ended up using PadRight.
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bill | last post by:
I have two tables of book information. One that has descriptions of the book in it, and the isbn, and the other that has the book title, inventory data, prices, the isbn. Because of some...
0
by: Doug | last post by:
I'm trying to code something so that I can line up product information under it's titles like so: Product#: Qty Price Product Name 6666 1 7.5 Product2 Using the \t code in C# doesn't work...
16
by: chudson007 | last post by:
I have a table, TableA with amongst other fields, a field for Qty. Qty can range from 0 to 100. How do I count the number of rows with a qty between 1 and 10, 11 and 20, 21 and 30, and so on using...
5
by: DC Gringo | last post by:
I am having a problem reading a simple update to the database. Basically I'm testing a small change to the pubs database -- changing the price of the Busy Executive's Database Guide from 19.99 to...
6
by: Guabble | last post by:
Hi Can anyone help me? I want to be able to show my sqldatareader contents in a gridview whereby the child data is concatenated up in a single row. Is this possible? For example Author...
6
by: RickH | last post by:
Hello, I would like to create a user XSD data type that inherits from the w3 standard data type called ID to make sure a certain repeated element always contains distinct values. The problem is...
4
by: Adam | last post by:
I have four roughly square DIVs, all the same height, which I need to line up horizontally across the page. What would be the best way to do this? At the moment I have a very botched solution where...
3
by: yarivot26 | last post by:
Hi, I have a form where the user can select a product and the product info will appear next to it. The products and the data on them all come from a db so I needed it to be dynamically. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.