🔒 Closed [HELP] Guys pahelp namn sa print ListView With Database

Status
Not open for further replies.
Pahelp naman guys wala lang po ako makitang tutorial na print tutorial gamit ang listview mostly kase ang makikita sa youtubes is datagridview ang gamit, may nakikita namn pong listview kaso basic lang po yung sa kanila saken po my database. sana po matulugan nyo ako


Eto namn po yung code ko sa listview
Sub fillsview() Try ListView1.Items.Clear() 'Safe in SQL iNJECT' objcmd = New MySql.Data.MySqlClient.MySqlCommand("SELECT * FROM tbl_pcperipherals", objconn) 'Unsafe Vulnerable in SQL INJECT' 'strsql = "SELECT * FROM tbl_pcperipherals"' 'objcmd = New MySql.Data.MySqlClient.MySqlCommand(strsql, objconn)' objdr = objcmd.ExecuteReader While (objdr.Read) With ListView1.Items.Add(objdr("ProductID")) .SubItems.add(objdr("ProductName")) .subitems.add(objdr("ProductBrand")) .subitems.add(objdr("ProductCategory")) .subitems.add(objdr("ProductQuantity")) .subitems.add(objdr("ProductDescription")) .subitems.add(objdr("ProductManufacturer")) .subitems.add(objdr("Stock")) .subitems.add(objdr("Supplier")) .subitems.add(objdr("ContactNo")) End With End While objcmd.Dispose() objdr.Close() Catch ex As Exception MsgBox(ex.Message) Me.fillsview() End Try End Sub


Eto po yung code sa print ang gamit ko po is prindocument and printpreviewdialog po
Private Sub btnprint_Click(sender As Object, e As EventArgs) Handles btnprint.Click PrintPreviewDialog1.Document = PrintDocument1 PrintPreviewDialog1.ShowDialog() With PrintDocument1 .PrinterSettings.DefaultPageSettings.Landscape = True .Print() End With End Sub Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim H As Integer = 0 H = 50 e.Graphics.DrawString("PRINT", New Drawing.Font("Times New Roman", 10), Brushes.Black, 50, H) For Each Itm As ListViewItem In ListView1.Items e.Graphics.DrawString(Itm.Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 50, H) e.Graphics.DrawString(Itm.SubItems(0).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H) e.Graphics.DrawString(Itm.SubItems(1).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H) e.Graphics.DrawString(Itm.SubItems(2).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H) e.Graphics.DrawString(Itm.SubItems(3).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H) e.Graphics.DrawString(Itm.SubItems(4).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H) e.Graphics.DrawString(Itm.SubItems(5).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H) e.Graphics.DrawString(Itm.SubItems(6).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H) e.Graphics.DrawString(Itm.SubItems(7).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H) e.Graphics.DrawString(Itm.SubItems(8).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H) e.Graphics.DrawString(Itm.SubItems(9).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 150, H) H += 20 Next End Sub


eto po yung output ng printpreview ko po sana mabigyan nyoko ng code hehe
261297698_947079789560488_6693778269522830496_n.png
 
db browser yang sinasabi mo paps,.. anyway mysql ba gamit mong databse?

pa upload na rin ng interface mo paps, yung may listview mismo. screenshot mo lang yung naka run..

crystal report ba gmait mo sa printing paps?
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 792
    Views
  • 2
    Participants
Last reply from:
aprjhe143

Trending Topics

Online now

Members online
1,140
Guests online
1,517
Total visitors
2,657

Forum statistics

Threads
2,268,732
Posts
28,923,691
Members
1,243,037
Latest member
pogimopla
Back
Top