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:bigyello:
Printable View
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:bigyello:
See if lesson 16 helps you
http://www.free-ed.net/fr03/lfc/030202/120/
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.
Would it be easier to save the contents of the list box to a .txt file and then have VB print the .txt file?
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
You wouldnt have to clear the text file, when you write a new one, it will overwrite the old one.
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
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
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
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::
Make sure you use the -1 or you wont get the first item.
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
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.
...or....
put the contents of the datagrid to Excel?!
Cheers!