[RESOLVED] Print listview column header
I would like to know, How I can print listview column header? I cannot print the column header. Why? what wrong with this code?
Code:
'column header
For i = 1 To Form5.ListView2.ColumnHeaders.Count
Printer.Print Tab(5); Form5.ListView2.ColumnHeaders(1); _
Tab(25); Form5.ListView2.ColumnHeaders(2); _
Tab(45); Form5.ListView2.ColumnHeaders(3); _
Tab(65); Form5.ListView2.ColumnHeaders(4); _
Tab(85); Form5.ListView2.ColumnHeaders(5); _
Tab(105); Form5.ListView2.ColumnHeaders(6); _
Tab(125); Form5.ListView2.ColumnHeaders(7); _
Tab(145); Form5.ListView2.ColumnHeaders(8);
Next
Re: Print listview column header
try this statement...
vb Code:
Printer.Print Tab(5); Form5.ListView2.ColumnHeaders(1).Text; _
Tab(25); Form5.ListView2.ColumnHeaders(2).Text; _
Tab(45); Form5.ListView2.ColumnHeaders(3).Text; _
Tab(65); Form5.ListView2.ColumnHeaders(4).Text; _
Tab(85); Form5.ListView2.ColumnHeaders(5).Text; _
Tab(105); Form5.ListView2.ColumnHeaders(6).Text; _
Tab(125); Form5.ListView2.ColumnHeaders(7).Text; _
Tab(145); Form5.ListView2.ColumnHeaders(8).Text;
Re: Print listview column header
Thank you it work. But I would like to know, How I can print all column header in the listview without specific the number. Some thing like this
For i = 1 To Form5.ListView2.ColumnHeaders.Count How to do that?
Re: Print listview column header
vb Code:
Dim i As Integer, iTab As Integer
iTab = 5
For i = 1 To Form5.ListView2.ColumnHeaders.Count -1
iTab = iTab + 20
Printer.Print Form5.ListView2.ColumnHeaders(i).Text & Tab(iTab) ;
Next
Printer.EndDoc
Re: Print listview column header
What the purpose of this code?
iTab = iTab + 20
Re: Print listview column header
I made some modification. It works
Code:
Dim i As Integer, iTab As Integer
iTab = 5
For i = 1 To Form5.ListView2.ColumnHeaders.Count - 1
Printer.Print Tab(iTab); Form5.ListView2.ColumnHeaders(i).Text;
iTab = iTab + 20
Next
Re: [RESOLVED] Print listview column header
Quote:
Originally Posted by matrik02
What the purpose of this code?
iTab = iTab + 20
you are going to print all the column headers thru a loop and you need to specify the positions...instead of hardcoding the tab values in individual statements I put a variable which can do this..