i hve create 1 listview & checkbox inside listview...how to print check item in listview..
I think you want to print only the itmes checked within the listview. Is that correct?.
yes..this very importand to me..can u help me ?
lets see what you are working on.
i hve 1 project about product information..
all data from accessdatabase & i using oledb connection..so i only need print few data from listview..i hve create checkbox in listview but i dont know how to print selected data by checkbox..
i was asking you about the code that you are working on and which part you are struck with .
Yes, provide your code or at least the screenshot with a piece of data. You need to implement this through a PrintDocument Object. Something like the example in this Post. You need to add a System.Drawing.Printing.PrintDocument object to your Form and write the provided code in the PrintPage event of the control.
This sample only prints item text and its subitems. You need to adapt it and control when the items dont fit in just 1 page of the document but with this you can begin to print directly to a document.
Private Sub printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) Dim fuente as Font = new Font("Arial",14, FontStyle.Bold, GraphicsUnit.Point) Dim brocha as SolidBrush = new SolidBrush(Color.Black) e.Graphics.PageUnit = GraphicsUnit.Millimeter Dim sa as StringFormat = new StringFormat() sa.Alignment = StringAlignment.Far float ancho = e.Graphics.MeasureString(nombre_empresa, fuente).Width e.Graphics.DrawString("Products Information", fuente, brocha, new PointF(100, 3)) Dim fila as Integer=25 For Each item as ListViewItem In lstProducts.CheckedItems e.Graphics.DrawString(item.text, fuente, brocha, new PointF(12, fila )) e.Graphics.DrawString(item.SubItems(1).Text, fuente, brocha, new PointF(42, fila )) e.Graphics.DrawString(item.SubItems(2).Text, fuente, brocha, new PointF(72, fila )) e.Graphics.DrawString(item.SubItems(3).Text, fuente, brocha, new PointF(122, fila )) fila=fila + 10 Next brocha.Dispose() fuente.Dispose() End Sub
Please let me know if you need something else or if you have problems with this sample code.