I want to print contents in Listview..
can u please guide me..?
Printable View
I want to print contents in Listview..
can u please guide me..?
Perhaps this sample will be helpfull ...
This is a piece of code originally posted by MartinLiss (I don't have the actual link) that I've found very useful in the past.It needs to be tweaked for each individual ListView, but that usually doesn't require a whole lot of work.VB Code:
Private Sub Command1_Click() Dim i As Long Printer.FontName = "arial" Printer.FontUnderline = True Printer.FontSize = 8 Printer.Orientation = vbPRORLandscape Printer.Print "Lineitem"; _ Tab(30); "Description"; _ Tab(100); "Location" Printer.FontUnderline = False For i = 1 To ListView1.ListItems.Count Printer.Print ListView1.ListItems(i); _ Tab(30); ListView1.ListItems(i).ListSubItems(1); _ Tab(100); ListView1.ListItems(i).ListSubItems(2) Next Printer.EndDoc End Sub
MR HACK
first Congratulation for being Most Valuable Professional :thumb:
your code alias Martin sounds gr8.
Is there any genuine method..
that we just pass Cotrol name (* here in my problem ListView1 *)
I mean any kind of API ..>?
or something else more tricky.
Put that code in a function with a LISTVIEW argument - pass in the LISTVIEW you want to process.
That way it's a single function for all list views.
I would personally not use the TAB statement but instead find out the width of the listview columns and set the .CURRENTX value to move the print position along the line.
We do that for printing flexgrids - works very nicely.
there could be another option....Quote:
Originally Posted by vbPoet