|
-
Jan 24th, 2004, 09:42 PM
#1
Thread Starter
Addicted Member
Printing the contents of a listbox [RESOLVED]
Here's a question for the masses. I am writing a program and i want to print the information in a list box.
I'm sure it's easy, but i can't seem to get it to work.
I'd appreciate the help
Last edited by SuperChris9; Jan 24th, 2004 at 11:00 PM.
-
Jan 24th, 2004, 09:45 PM
#2
Frenzied Member
-
Jan 24th, 2004, 10:00 PM
#3
Thread Starter
Addicted Member
yeah, it didn't really help. I know the concept of how to print, i'm just having trouble figure out what property to send to the printer or some way of dumping the contents of the listbox to the printer. I have tried printer the text, list, itemdata properties, but just get a blank page, or an error.
Last edited by SuperChris9; Jan 24th, 2004 at 10:09 PM.
-
Jan 24th, 2004, 10:11 PM
#4
Frenzied Member
Would it be easier to save the contents of the list box to a .txt file and then have VB print the .txt file?
-
Jan 24th, 2004, 10:13 PM
#5
Thread Starter
Addicted Member
i could do that, but, then i'd have to clear the text file after everyprint, but what i'm trying to do is add a deli order to a list box and send it to a printer, if there is an easier idea on how to do it, i'm totally up to it
-
Jan 24th, 2004, 10:14 PM
#6
Frenzied Member
You wouldnt have to clear the text file, when you write a new one, it will overwrite the old one.
-
Jan 24th, 2004, 10:17 PM
#7
Thread Starter
Addicted Member
ok, then i'll do that, but how do i save the contents of the listbox to a text file then. Like i have said before, i'm trying to relearn all of this
-
Jan 24th, 2004, 10:30 PM
#8
Frenzied Member
Try this link, its a routine I made for someone else not long ago. You can modify it for your needs I think. If not, let me know and I'll lend a hand.
http://www.vbforums.com/showthread.p...highlight=list
-
Jan 24th, 2004, 10:57 PM
#9
Addicted Member
Maybe I'm missing the point, but why not just do this?
VB Code:
Dim x As Long
For x = 0 To List1.ListCount - 1
Printer.Print List1.List(x)
Next x
-
Jan 24th, 2004, 10:58 PM
#10
Thread Starter
Addicted Member
hey, thanks alot but, i figured it out. this was the code i used:
VB Code:
Private Sub Command1_Click()
Dim intx As Integer
For intx = 0 To List1.ListCount
Printer1.Print List1.List(intx)
Next intx
End Sub
it seems like that shoulda been such an obvious answer ::smacks head::
-
Jan 24th, 2004, 11:00 PM
#11
Frenzied Member
Make sure you use the -1 or you wont get the first item.
-
Jan 24th, 2004, 11:01 PM
#12
Thread Starter
Addicted Member
I still got the first item, the list index goes from -1 and up, but the first items is at zero isn't it, well anyway i still got the first item in the list
-
Feb 3rd, 2004, 06:56 AM
#13
Hyperactive Member
Along the same lines, how do I print the contents of a datagrid? This is probably very simple but I'm a bit stupid!
Tar.
The Bloke
www.blokeinthekitchen.com
making cooking cool for blokes
-
Feb 3rd, 2004, 07:23 AM
#14
Hyperactive Member
HELP!!
...or....
put the contents of the datagrid to Excel?!
Cheers!
The Bloke
www.blokeinthekitchen.com
making cooking cool for blokes
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
|