Private Sub printButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles printButton.Click printDocument1.DocumentName = "myFile.txt" printDocument1.PrinterSettings.FromPage = 1 printDocument1.PrinterSettings.ToPage = totalPages printDocument1.PrinterSettings.MinimumPage = 1 printDocument1.PrinterSettings.MaximumPage = totalPages printDialog1.AllowSomePages = True If printDialog1.ShowDialog() = DialogResult.OK Then If printDialog1.PrinterSettings.PrintRange = Drawing.Printing.PrintRange.SomePages Then page = printDocument1.PrinterSettings.FromPage maxPage = printDocument1.PrinterSettings.ToPage Else page = 1 maxPage = totalPages End If End If printDocument1.Print() End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Command1_Click()
For j = 0 To 19
Form30.Label1(j).Caption = ""
Form30.Label2(j).Caption = ""
Form30.Label3(j).Caption = ""
Form30.Label4(j).Caption = ""
Form30.Label5(j).Caption = ""
Next j
For j = 0 To 5 'donnes fixes lié à la list (entreprise, adresse...)
Form30.Label6(j).Caption = ""
Next j
'Mise en place de la liste sur la feuille d'impression
NbAff = Form28.List1.ListCount - 1
Nblig = 0
NbP = 1
For i = 0 To NbAff
If Nblig = 20 Then 'Feuille pleine
Nblig = 0
Form30.Label24.Caption = NbP
NbP = NbP + 1
Form30.Label6(0).Caption = Form28.Combo4.Text & " " & Form28.Combo5.Text 'je remplis les champs de renseignements, j'imprime & je reset la feuille
Form30.Label6(1).Caption = Form28.Combo1.Text
Form30.Label6(2).Caption = Form28.Combo3.Text
Form30.Label6(3).Caption = Form28.Label6.Caption & " " & Form28.Label8.Caption
Form30.Label6(4).Caption = Form28.Combo2.Text
Form30.Label6(5).Caption = Form28.Label1.Caption & " " & Form28.Label3.Caption
Form30.PrintForm
For j = 0 To 19
Form30.Label1(j).Caption = ""
Form30.Label2(j).Caption = ""
Form30.Label3(j).Caption = ""
Form30.Label4(j).Caption = ""
Form30.Label5(j).Caption = ""
Next j
For j = 0 To 5
Form30.Label6(j).Caption = ""
Next j
End If
mach = Form28.List1.List(i)
numadv = Mid(mach, 1, 11)
Form28.Data2.Recordset.MoveFirst
crit = "[N° de Com]='" & numadv & "'"
Form28.Data2.Recordset.FindFirst crit 'prise des infos dans suicom
Typ = Form28.Data2.Recordset.Fields("Type").Value
Mdl = Form28.Data2.Recordset.Fields("Modèle").Value
con = Form28.Data2.Recordset.Fields("N° de Contrat").Value
cli = Form28.Data2.Recordset.Fields("Client").Value
Form30.Label1(Nblig).Caption = numadv 'remplissage dans tableau
Form30.Label2(Nblig).Caption = Typ
Form30.Label3(Nblig).Caption = Mdl
Form30.Label4(Nblig).Caption = con
Form30.Label5(Nblig).Caption = cli
Nblig = Nblig + 1
Next i
Form30.Label24.Caption = NbP 'je remplis les champs de renseignements & j'imprime
Form30.Label6(0).Caption = Form28.Combo4.Text & " " & Form28.Combo5.Text
Form30.Label6(1).Caption = Form28.Combo1.Text
Form30.Label6(2).Caption = Form28.Combo3.Text
Form30.Label6(3).Caption = Form28.Label6.Caption & " " & Form28.Label8.Caption
Form30.Label6(4).Caption = Form28.Combo2.Text
Form30.Label6(5).Caption = Form28.Label1.Caption & " " & Form28.Label3.Caption
Form30.PrintForm
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click PrintDocument1.PrinterSettings.FromPage = 1 PrintDocument1.PrinterSettings.ToPage = 2 PrintDocument1.PrinterSettings.MinimumPage = 1 PrintDocument1.PrinterSettings.MaximumPage = 2 printdialog1.Document = PrintDocument1 Dim result As DialogResult = printdialog1.ShowDialog If (result = DialogResult.OK) Then PrintDocument1.Print() End If End Sub