[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 131
  • Last Modified:

Print 5 columns of 20

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
mad3654
Asked:
mad3654
1 Solution
 
Brendt HessSenior DBACommented:
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now