HLP: Printing an Array

  • Thread starter Thread starter Mr. B
  • Start date Start date
M

Mr. B

I've a 3D array --> myArray(14, 20)

This array contains both Text and Numbers.

What I'd like to do is to have a "Simple" output to Print.

Nothing fancy on Text and stuff (the default of FixedSys font I will use is
plenty).

But I want to line up my information in 'fixed' Columns. And the numbers range
from 0 to 60 (and can contain decimals to 2 places).

Any feed back appreciated.

Regards,

Bruce
 
Hi Bruce,

There was a question about formatting only yesterday. This is what I gave:

There are loads of ways of formatting things

The ToString method of numbers and strings takes formatting parameters which
you can read about here.

Formatting in .NET
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconformattingtypes.asp


There's also the good old VB Format function which is described here:

Format Function
http://msdn.microsoft.com/library/en-us/vblr7/html/vafctFormat.asp

And then there are quite a few functions for playing with strings.
For instance you could use
sSomething.PadLeft (10, " "c) 'Right-aligned in a 10-width column

Regards,
Fergus

--
==================================================
Thought for the day

Herfried: I don't need/want human interaction.

==================================================
(There's a feud going on)
 
Hi Bruce,

Ok, that was some pointers for the formatting. Let's look at this array.

You say 3D but there are only two indices in your array which makes
it 2D. This is much easier to display, of course, but you may have left out
the third index.

What you need to show us is an example of how you'd like the printout
to look. Give us some array values and the corresponding output.

Regards,
Fergus

--
(Please ignore this - there's a feud going on)
==================================================
Thought for the day

Herfried: I don't need/want human interaction.
==================================================
 
Fergus Cooney said:
You say 3D but there are only two indices in your array which makes
it 2D. This is much easier to display, of course, but you may have left out

Duh! Sorry... I meant 2D (banging head on wall). Sheesh! (:
What you need to show us is an example of how you'd like the printout
to look. Give us some array values and the corresponding output.

Hmmm.... The basic format will be:

String1 String2 String3 String4 Numer1 Number2 ... etc. to Number 7
String5 (whole line)

In reality it is the output of a Weekly Time sheet:
Project Number + Project Name + Cost Code # + Code Code Description + Sat Hrs
+ Sun Hrs + Mon Hrs ... to Fri Hrs

Then String5 is Description of Work.

I did find an example of a ListView being displayed (5 columns). Then a print
preview which they created a 'Table' (3 columns) and populated it with
selected columns out of the original 5 columns.

Pretty slick. I'll have to see if I can figure it out cause it seems to word
wrap in each cell in the print preview. A bit more 'fancier' than I was going
for. But I'll probably tackle this after I just get the output in a plain
Jane flavour.

Thanks (as usual)

Bruce
 
Fergus Cooney said:
There was a question about formatting only yesterday. This is what I gave:

Hmm... didn't see that one.
The ToString method of numbers and strings takes formatting parameters which
you can read about here.

Yeah... I use to do something like that in VB6. The only big thing I've run
across is since each 'character' is not the physically same 'width', it's just
a lot of screwing around to get the formatting just right. IE: a 'P' is not
the same width as a '-'. So you get 150 "P" on a line... and 240 "-". Argh!

And when you are dealing with strings having different lengths!

I think it was back in some older VB there use to be a way you could setup a
format of a line mixing strings and number. Kinda like:

LineFormatLike = "/ / '###.##' / / / /"

.... where you could place text between the / / (and they would control
the number of characters depending on how many 'spaces'). ### dealt with
numbers.

I'll look them up.
And then there are quite a few functions for playing with strings.
For instance you could use
sSomething.PadLeft (10, " "c) 'Right-aligned in a 10-width column

Hmmm... didn't know the " "c option. Kewl!

Thanks (as ususal) I:
==================================================
Thought for the day

LOL... I've hundreds of One-Liners....

* All of my REALLY GOOD Sigs are one character too lon
* Don't play stupid with me... I'm better at it!
* Girls with the most streamlined curves offer the most resistance!
* I think I'm suffering from mood poisoning, it must be something I hate!
* It takes a lot of brains to enjoy satire, humor and wit - but none to be
offended by them.
* No, there are no more bugs! (what the?) ///\oo/\\\ ///\oo/\\\
* There are 3 kinds of people: those who can count & those who can't!
* Without my ignorance, your knowledge would be meaningless!
 
Back
Top