How do I align stuff like this in VB6?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 10 October 2003   #1
How do I align stuff like this in VB6?

Okie, so I'm trying to spew out a bunch of numbers in a table like format.

Item Qty $/ea. Sub Total
----------------------------------
Item1 15.00
Item2 1.25
Item3 1.00
Item4 0.75

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.
 
Old 10 October 2003   #2
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?
__________________
"Game developers are like simple chemicals. (No, not because they're cheap and smelly.) In the right combination, they can make miracles. Screw up the mix, and you can blow up a city." - How to Screw Up a Perfectly Good Game Company in Ten Easy Steps, www.gamedev.net
 
Old 10 October 2003   #3
Like Nighthawk said:use the MsFlexgrid control.
__________________
Meli
 
Old 10 October 2003   #4
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):

Format$((Format$(strVar, "##00.00"),"@@@@@@")

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:

Tab(#)strVar1; Tab(#)strVar2

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?
 
Old 10 October 2003   #5
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.
__________________
"Game developers are like simple chemicals. (No, not because they're cheap and smelly.) In the right combination, they can make miracles. Screw up the mix, and you can blow up a city." - How to Screw Up a Perfectly Good Game Company in Ten Easy Steps, www.gamedev.net
 
Old 11 November 2003   #6
sweeeeet, thanks for the nfo. I'll play w/ that little trick when I get a chance to.
 
Old 01 January 2006   #7
Thread automatically closed

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.
 
Thread Closed share thread



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:07 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.