|
-
Nov 1st, 2000, 07:28 AM
#1
Thread Starter
Hyperactive Member
I need to print the contain of a list box into 6 colunms.
EX:
listbox1.list =
xxxxxx-xxx
xxxxxx-xxx
xxxxxx-xxx
. . .
I want that comes out the printer
xxxxxx-xxx xxxxxx-xxx xxxxx-xxx xxxxxx-xxx xxxxxx-xxx
xxxxxx-xxx xxxxxx-xxx xxxxx-xxx xxxxxx-xxx xxxxxx-xxx
Please Help!
-
Nov 1st, 2000, 07:40 AM
#2
_______
<?>
Have to go to work..just change this to read your
list
Option Explicit
Private Sub Command1_Click()
Dim i, j, k
j = 1
i = "XXXX_ xx"
For k = 1 To 18
If j < 6 Then
Printer.Print i,
Else
Printer.Print i:
If j = 6 Then j = 0
End If
j = j + 1
Next k
Printer.EndDoc
End Sub
'will check at work to see if you need further help
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 1st, 2000, 07:55 AM
#3
Somekind of solution...
Well, you could print first the listbox contents into a string and print it then.
Code:
'just add into any control
Dim A As Integer
Dim B As Integer
Dim Text As String
Text = ""
Do While A < List1.ListCount
B = B + 1
If B > 6 Then B = 1: Text = Text & vbNewLine
Text = Text & " " & List1.List(A)
A = A + 1
Loop
Printer.Print Text
Printer.EndDoc
Hope this helps,
[Edited by MerryVIP on 11-01-2000 at 08:27 AM]
-
Nov 1st, 2000, 08:09 AM
#4
Hyperactive Member
Do this:
Code:
Private Sub cmdPrint_Click()
Dim tmp As String
For i = 0 To List1.ListCount - 1
tmp = tmp & List1.List(i) & vbNewLine
Next i
Printer.Print tmp
Printer.EndDoc
End Sub
Any help?
-
Nov 1st, 2000, 08:12 AM
#5
Hyperactive Member
Wait a second...
Did you want it to come this way:
xxxxxx-xx
xxxxxx-xx
or:
xxxxxx-xx xxxxx-x
If you chose the first option see my previous post.
If you choose the second do this:
Code:
Private Sub cmdPrint_Click()
Dim tmp As String
For i = 0 To List.ListCount - 1
tmp = tmp & List1.List(i) & " "
Next i
Printer.Print tmp
Printer.EndDoc
End Sub
Did this help now?
-
Nov 1st, 2000, 08:26 AM
#6
He meant, they come six in a line!
xxxx xxxx xxxx xxxx xxxx xxxx <- End of line 1
xxxx xxxx xxxx xxxx xxxx xxxx <- End of line 2
etc.
My code does this perfectly...So I wonder why you add something that isn't really answer to the question.
Sorry
-
Nov 1st, 2000, 08:37 AM
#7
_______
<?>
MerryVip:
Don't be too harse on other people's answeres; sometimes, they don't quite see it as you or someone else does. Your code is the same as the quick fix I transcribed except that it is expressed by yourself as printing the listbox.
I was running late for work so I merely expressed it as the formula for doing what was required.

It doesn't matter what other's post, as long as the questioner can find the answer in the postings, that is all that counts.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 1st, 2000, 08:43 AM
#8
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|