printing...

G

Guest

Hi!
How can I print data stored in a listView?
I only found some vb6.0 code and I wonder how to substitute the
printer-object etc.
are there any possibilities of printing easily using the .net framework?
or should i use another control and no listview?

please help me ;)
Samuel
 
J

JR

Add a printDocument control
add code to the control like

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e
As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
Dim li As String
Dim nY_Loc, x_Marge As Long
Dim Myfont As New Font("Arial", FontStyle.Regular)
Try
For Each li In ListBox1.Items
e.Graphics.DrawString(li, MyFont, Brushes.Blue, x_Marge, nY_Loc)
nY_Loc += e.Graphics.MeasureString(li, Myfont).Height
Next
Catch ex As Exception
MsgBox("Something whent wrong")
End Try
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top