473,396 Members | 1,918 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,396 software developers and data experts.

VB-WEB: Array Output Sorting Issue

Hello. First of all I'm programming in VB.NET/ASP.NET doing a page for a website. Now, to my question....

I have a simple array of integer numbers (15 characters in length) which can hold up to 2000 items. What I basically need to do is output these numbers to a PDF file I'm creating on the fly and I can only fit a certain amount of numbers per page. What I need to do is just output these on each page in numerical order vertically NOT horizontally. Based on page size restrictions, the amount of numbers I can output per page is 19 rows x 7 columns (or 133 items total).

Now, I already have the PDF creation going fine, including adding more pages as there's more numbers being added, etc. It's just the sorting of these numbers that I'm outputting I'm having trouble with. What I'm doing currently (which is archaic), since I can only output horizontally at the moment, is outputting the first number, then skipping the next 18, and then outputting the next number, then skipping the next 18, etc. Once I get to the 7th number (1st row, 7th column), I output it, skip backwards to the 2nd number in the array, and output it as I'll now be in the 2nd row (2nd row, 1st column). I keep doing this until all numbers in the array are output. The only problem is that, other than being finicky and definitely not an efficient way of doing it, is if the array has fewer than 133 numbers (or if by chance there's fewer than 133 numbers on any one page), the output structure is all messed up.

For more info on what I'm currently doing, here's some code examples:

Expand|Select|Wrap|Line Numbers
  1. Dim theTagArray(2000) As String
  2. ' theTagArray is filled before this next section...
  3.  
  4. Dim thecount2 As Integer = 0
  5. Dim thecount3 As Integer = 0
  6. Dim thenum As Integer = 19
  7. ' Nice mess to print tags in numeric order down each column, left to right...
  8. ' Basically, start with first element, then skip 18 and put next, skip 18 put next, etc. and so forth...
  9. ' pdfText2a.Add is the function that's basically outputting the array element... to the PDF...
  10.     If thecount3 = 7 Then
  11.     thecount2 += 1
  12.     thecount3 = 0
  13.     pdfText2a.Add(theTagArray(thecount2 + (thecount3 * thenum)) & " | ")
  14.     thecount3 += 1
  15.     Else
  16.     pdfText2a.Add(theTagArray(thecount2 + (thecount3 * thenum)) & " | ")
  17.     thecount3 += 1
  18.     End If
  19.  
I want it to look kind of like this:

982000018301450 | 982000018561709 | ...
982000018561265 | 982000018561724 | ...
...
Though 7 across, 19 down.

So, this is why I'm asking if there's a way to output an array vertically instead of horizontally in either a slightly more efficient way than I'm doing it, or by using a much better method altogether. Please help if you can. Thanks for your help.
Mar 24 '08 #1
1 1272
Plater
7,872 Expert 4TB
So your output would be like:
Expand|Select|Wrap|Line Numbers
  1. 1 |  5  |  9 |
  2. 2 |  6  | 10 |
  3. 3 |  7  | 11 |
  4. 4 |  8  | 12 |
  5.  
What happens at page break? Should the first column go down to bottom of page and continue into 2nd column, then 3rd, 4th, etc until it must go to next page?
Mar 24 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Terry | last post by:
Hi, I need some feedback. We are converting to .Net and we are trying to decide on whether to use VB.net or C#.net. As far as our current systems, they will probably be rewritten in ASP.Net. I...
28
by: Andy | last post by:
Any good resources regarding benefitis by using C3 over VB? /Andy
16
by: Ben Hannon | last post by:
Hi, I'm writting a COM Class in VB.NET to be used in a VB6 project (Tired of the VB6 hassles with cloning and serializing an object). All my classes I need cloneable/serializable are now in a...
182
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
25
by: Sharrukin Amiri | last post by:
Hello, I am using VB 6.0 for many years. Everytime I needed to build software applications, I just opened VB 6.0 and started coding. I am now looking VB.NET Express Edition and I find I can no...
19
by: lonelyplanet | last post by:
Hi, I'm studying for 70-306 using the book "MCAD/MCSD Visual Basic .NET Windows Applications" published by McGraw Hill (ISBN: 0-07-212583-7). I found the book has no programming exercise...
15
by: Manny Chohan | last post by:
Hey Guys, Can some one tell me why is there more demand for C# vs VB .NET? Personally i have programmed in VB .net a little bit and have found it easier to use. Is there any hidden secret...
97
by: Master Programmer | last post by:
Thinking of learning VB.NET? New programmer? Thinking of Moving over from VB 6.0? Read on friend, let me help you make a more informed decision......... Microsoft are a pathetic company,...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.