mi codigo.....
esto va antes de public class
Imports System.Drawing.Printing
Cita:
Private Sub Bimprimir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bimprimir.Click
seleccionarImpresora()
End Sub
Private Function seleccionarImpresora() As Boolean
Dim ppd As New PrintDialog
Dim prtsettings As New PrinterSettings
Dim printDoc As New PrintDocument
If prtSettings Is Nothing Then
prtSettings = New PrinterSettings
End If
With ppd
.AllowPrintToFile = False
.AllowSelection = False
.AllowSomePages = False
.PrintToFile = False
.ShowHelp = False
.ShowNetwork = True
.PrinterSettings = prtSettings
If .ShowDialog() = DialogResult.OK Then
prtsettings = .PrinterSettings
AddHandler printDoc.PrintPage, AddressOf print_PrintPage
printDoc.Print()
Else
Return False
End If
End With
Return True
End Function
Private Sub print_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
Dim Y As Integer = 50
Dim cantidad As Integer = 0
Dim totalfaltas As Integer = 0
dsppc = objpersonal.obtenerpersonalporcargo(CbCargo.Select edValue)
e.Graphics.DrawString("Nombre" & " " & "Apellido" & " " & "DNI" & " " & "Cargo" & " " & "Fecha de Alta" & " " & "firma", New Font("Arial", 12, FontStyle.Bold), Brushes.Red, 100, Y)
Y = Y + 1
e.Graphics.DrawString("___________________________ ___________________________________________", New Font("Arial", 12, FontStyle.Bold), Brushes.Red, 100, Y)
Y = Y + 5
For Each x As DataRow In dsppc.Tables("personalporcargo").Rows
Y = Y + 20
e.Graphics.DrawString(x.Item(0) & " - " & x.Item(1) & " - " & x.Item(2) & " - " & x.Item(3) & " - " & x.Item(4) & " - _________________", New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 100, Y)
Next
dsppc.Clear()
e.HasMorePages = False
End Sub
seleccionarImpresora()
End Sub
Private Function seleccionarImpresora() As Boolean
Dim ppd As New PrintDialog
Dim prtsettings As New PrinterSettings
Dim printDoc As New PrintDocument
If prtSettings Is Nothing Then
prtSettings = New PrinterSettings
End If
With ppd
.AllowPrintToFile = False
.AllowSelection = False
.AllowSomePages = False
.PrintToFile = False
.ShowHelp = False
.ShowNetwork = True
.PrinterSettings = prtSettings
If .ShowDialog() = DialogResult.OK Then
prtsettings = .PrinterSettings
AddHandler printDoc.PrintPage, AddressOf print_PrintPage
printDoc.Print()
Else
Return False
End If
End With
Return True
End Function
Private Sub print_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
Dim Y As Integer = 50
Dim cantidad As Integer = 0
Dim totalfaltas As Integer = 0
dsppc = objpersonal.obtenerpersonalporcargo(CbCargo.Select edValue)
e.Graphics.DrawString("Nombre" & " " & "Apellido" & " " & "DNI" & " " & "Cargo" & " " & "Fecha de Alta" & " " & "firma", New Font("Arial", 12, FontStyle.Bold), Brushes.Red, 100, Y)
Y = Y + 1
e.Graphics.DrawString("___________________________ ___________________________________________", New Font("Arial", 12, FontStyle.Bold), Brushes.Red, 100, Y)
Y = Y + 5
For Each x As DataRow In dsppc.Tables("personalporcargo").Rows
Y = Y + 20
e.Graphics.DrawString(x.Item(0) & " - " & x.Item(1) & " - " & x.Item(2) & " - " & x.Item(3) & " - " & x.Item(4) & " - _________________", New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 100, Y)
Next
dsppc.Clear()
e.HasMorePages = False
End Sub
y algo asi me queda la impresio (un asco =( )
Cita:
Nombre - Apellido --- DNI -- Cargo --- Fecha de Alta ---- firma
Viviana - Aguirre - 28249773 - Profesor - 11/11/2010 - _________________
horacio - santucho - 44546444 - Profesor - 02/12/2010 - _________________
romina - silva - 33234777 - Profesor - 03/01/2011 - _________________
Viviana - Aguirre - 28249773 - Profesor - 11/11/2010 - _________________
horacio - santucho - 44546444 - Profesor - 02/12/2010 - _________________
romina - silva - 33234777 - Profesor - 03/01/2011 - _________________
por favor ayuda ya tengo que imprimir muchos documentos de este tipo...