Print 5 columns of 20

Posted on 2000-03-07
Last Modified: 2010-05-02
This project is suppose to print 5 columns of 20 rows.  Could you tell me why it is printing rows of 5?

1.  323 21. 300 41. 275 61. 289 81. 280
20. 297 40. 299 60. 293 80. 300 100. 304
Dim A(30000) As Long
Dim B As Long
Dim C(100) As Long
Private Sub cmdExit_Click()
End Sub

Private Sub Command1_Click()

Print Tab(20); "Name"; Tab; "Project"; vbCrLf
For x = 1 To 30000
    B = A(x)
    C(B) = C(B) + 1
I = 1
For I = 1 To 100
    'print out arrays
    Quiz4.Print Format$(I, "@@@."); C(I); Tab;
    If I Mod 20 = 0 Then Quiz4.Print vbCrLf  'columns

End Sub

Private Sub Form_Load()
Dim I As Integer
'initilizing array
For I = 1 To 3000
    A(I) = Int(Rnd * 101)
End Sub

Private Sub Print_Click()
End Sub
Question by:mad3654
1 Comment
LVL 32

Accepted Solution

bhess1 earned 35 total points
ID: 2593579
vbCrLf is an end of line, not an end of column command.  To get the layout you were trying for (as shown in your example), try this code:

For I = 1 To 20
    'print out arrays
    Quiz4.Print Format$(I, "@@@.");
      C(I); Tab; Format$(I+20, "@@@.");
      C(I+20); Tab; Format$(I+40,
      "@@@."); C(I+40); Tab;
      Format$(I+60, "@@@."); C(I+60);
      Tab; Format$(I+80, "@@@.");

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question