473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Printing multicolumn listview

I am trying to print the content of a listview with eight columns in it in vb.net 2003. So far everything I have tried has not worked. Below is the last code I tried using. It will print, however the printing looks like everything is on top of each other. Help!!

Expand|Select|Wrap|Line Numbers
  1.  Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
  2.         PrintPreviewDialog1.Document = PrintDocument1
  3.         PrintPreviewDialog1.Show()
  4.  
  5.         PrintDocument1.Print()
  6.  
  7.     End Sub
  8.  
  9.  
  10.     Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
  11.         Try
  12.             Dim lvwItem As New ListViewItem
  13.             Dim lvwSubItem As New ListViewItem
  14.  
  15.             'counter for display purposes
  16.             Dim listviewcount As Integer = 1
  17.  
  18.             'loop through the listview items
  19.             For Each lvwItem In lvClientInfo.Items
  20.                 e.Graphics.DrawString(lvwItem.Text(), New Font("Arial", 12, FontStyle.Regular), Brushes.Black, 150, 125)
  21.  
  22.                 'counter for display purposes
  23.                 Dim icount As Integer = 1
  24.  
  25.                 'print the subitems of the listview item
  26.                 For Each lvwSubItem In lvClientInfo.Items
  27.                     e.Graphics.DrawString(lvwSubItem.Text(), New Font("Arial", 12, FontStyle.Regular), Brushes.Black, 150, 125)
  28.  
  29.                 Next
  30.                 'increment the count
  31.                 listviewcount += 1
  32.                 icount += 1
  33.  
  34.             Next
  35.  
  36.         Catch ex As Exception
  37.  
  38.             MsgBox(ex.Message)
  39.  
  40.         End Try
  41.     End Sub 
Jul 28 '08 #1
0 1341

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mazin Al-Noaimi | last post by:
Hi all, I want to add three values each time to the list box to be as one record for example I have first name, last name, phone number values I want to add them to a listbox once to be...
4
by: kackson | last post by:
Hi. I attempted to create a multicolumn listbox for my web based aspx application. I search the net, all I get is something like listview or I need to have system.windwos.form. But for the...
1
by: nsteele84 | last post by:
Hi I have the following code for a 3 column listview: intNumItemsSelected = lstPieceMark.SelectedItems.Count For intCount = 0 To intNumItemsSelected - 1 strPieceMark =...
7
by: Paul Bromley | last post by:
How can I use this please - I need 2 columns. I have been having difficulty finding info on this and the 2005 Treeview control today. Many thanks for any links or info, Paul Bromley
1
by: uto | last post by:
i'd like to know about printing of webpage ListView tablele this listview is like resume table forms so i have to print as this page of table type. may be listview count is about 50. how can i...
2
by: dev.amit | last post by:
Hello Friends I am a new bee to the world of vb. I have an appication in the MS Access and now i have to convert it to the Vb. I am having problem creating multicolumn Listbox in the vb form....
10
by: Rob | last post by:
VS 2005 How can you tell if a value is contained in a specific column (let's say column 1 named Status) of a ListView ? In a list box you could go... If ListBox1.Items.Contains(strWhatever)...
5
by: WRH | last post by:
Hello I want to have a multicolumn listbox. I never used one before so I looked at a Help example. I set the multicolumn property and the column width and tested with this example... ...
1
by: piercy | last post by:
Hi, ive been trying to produce something using a listview control which shows error messages for the emails sent from my application. Its a wierd concept so im going to try explain it best i can. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.