View Full Version : How do I align stuff like this in VB6?
10 October 2003, 06:08 AM
Okie, so I'm trying to spew out a bunch of numbers in a table like format.
Item Qty $/ea. Sub Total
Okay, so it's supposed to look something like that but I can't figure out how to get the output to align around the decimal. Basically, I want all the decimals to be vertical down the column and the numbers placed on either side of those decimals. I was looking @ the format command for decimals but wasn't sure how to implement it. I tried some confusing stuff w/ trying to to Space(15-Val(Item1.Text)) and stuff like that... but it didn't quite work.
oh, and there are two more columns in that table too. So there are a total of four columns, item, qty, unit cost, and subtotal. I need them all to vertically align according to the vertical alignment of the decimals, but I dunno how to do that. Btw, this is a print to screen command.
10 October 2003, 07:40 AM
You may want to pad the numbers for looks and ease of lining them up.
However why do you want to output text in a table format when you could just output to a grid ocx?
10 October 2003, 04:42 PM
Like Nighthawk said:use the MsFlexgrid control.
10 October 2003, 05:44 PM
lol, this is only my 7th week into my first quarter of Visual Basic programming. Can someone point me to a link about MSFlexGrid control? Actually, I found another method from Microsoft's website that did something like (I'm typing from memory @ the moment):
It works perfectly after implementing the correct Space(#). But the only thing I don't understand is how the the parameter of "##00.00" works... I know # is reserved for a digit, but what does the 0 represent?
Anyhow, originally I was doing it this way:
But that didn't line stuff up to the decimal. So yeah, can someone give me some light into how the ##00.00 and @ symbols work in this function?
10 October 2003, 06:34 PM
right click the toolbox and click on components then check off the flex grid and click ok. From there drag your grid onto the form and give it a name. You can then treat it like a black box and have it working in no time. The easiest way to learn how to use it is to look at its properties and functions through the object browser.
11 November 2003, 06:17 AM
sweeeeet, thanks for the nfo. I'll play w/ that little trick when I get a chance to.
01 January 2006, 01:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.