Solved

Print 5 columns of 20

Posted on 2000-03-07
1
127 Views
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?

sample:
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
End Sub

Private Sub Command1_Click()

Cls
Print Tab(20); "Name"; Tab; "Project"; vbCrLf
For x = 1 To 30000
    B = A(x)
    C(B) = C(B) + 1
Next
   
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
Next

End Sub

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



Private Sub Print_Click()
Quiz4.PrintForm
End Sub
0
Comment
Question by:mad3654
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
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, "@@@.");
      C(I+80)
Next
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

724 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