IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

comment utiliser HASMOREPAGE dans ce code?


Sujet :

VB.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre habitué
    Inscrit en
    Mars 2010
    Messages
    11
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Mars 2010
    Messages : 11
    Par défaut comment utiliser HASMOREPAGE dans ce code?
    bonjour,

    comment puis-je imprimer sur 2 pages .......
    je ne comprend pas comment utiliser HASMOREPAGE
    note:ObjetDataTable.Rows.Count - 1=12
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
     For i = 0 To ObjetDataTable.Rows.Count - 1
     
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("N°ligne").ToString, Ft1, New SolidBrush(Color.Black), 10, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Immatriculation").ToString, Ft1, New SolidBrush(Color.Black), 70, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Nom-de-lassuré").ToString, Ft1, New SolidBrush(Color.Black), 220, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Prenom-de-lassuré").ToString, Ft1, New SolidBrush(Color.Black), 380, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Date-Naissance").ToString, Ft1, New SolidBrush(Color.Black), 530, x)
                e.Graphics.DrawString(Val(ObjetDataTable.Rows(i).Item("Montant-générale")).ToString("000.00"), Ft1, New SolidBrush(Color.Black), 770, x)
                x += 110
                MsgBox("x= " & x)
     
     
                If x = 880 Then
                    e.HasMorePages = True
                Else
                    e.HasMorePages = False
                End If
     
            Next
    merci de m'aider.

  2. #2
    Expert éminent Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 193
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 193
    Par défaut
    si tu mets hasmorepage à true je crois que ca rappelle le meme évènement, donc c'est toi au début de l'évent de savoir à quelle page tu en es
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

  3. #3
    Membre habitué
    Inscrit en
    Mars 2010
    Messages
    11
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Mars 2010
    Messages : 11
    Par défaut
    Citation Envoyé par Pol63 Voir le message
    si tu mets hasmorepage à true je crois que ca rappelle le meme évènement, donc c'est toi au début de l'évent de savoir à quelle page tu en es
    pouvez-vous corriger le code Je suis débutant en vb.net

  4. #4
    Expert éminent Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 193
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 193
    Par défaut
    tu peux nous mettre la sub complète ?
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

  5. #5
    Membre habitué
    Inscrit en
    Mars 2010
    Messages
    11
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Mars 2010
    Messages : 11
    Par défaut
    Citation Envoyé par Pol63 Voir le message
    tu peux nous mettre la sub complète ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Dim PrintPreviewDialog1 As New PrintPreviewDialog
            PrintDocument1.DefaultPageSettings.Landscape = True
            PrintPreviewDialog1.Document = PrintDocument1
            PrintPreviewDialog1.WindowState = FormWindowState.Maximized
            PrintPreviewDialog1.ShowDialog()
        End Sub
     
        Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
     
            Dim x As Integer = 0
     
            Dim Ft1 = New Font("Times New Roman", 14, FontStyle.Regular)
     
     
     
     
     
            For i = 0 To ObjetDataTable.Rows.Count - 1
     
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("N°ligne").ToString, Ft1, New SolidBrush(Color.Black), 10, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Immatriculation").ToString, Ft1, New SolidBrush(Color.Black), 70, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Nom-de-lassuré").ToString, Ft1, New SolidBrush(Color.Black), 220, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Prenom-de-lassuré").ToString, Ft1, New SolidBrush(Color.Black), 380, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Date-Naissance").ToString, Ft1, New SolidBrush(Color.Black), 530, x)
                e.Graphics.DrawString(Val(ObjetDataTable.Rows(i).Item("Montant-générale")).ToString("000.00"), Ft1, New SolidBrush(Color.Black), 770, x)
                x += 110
                MsgBox("x= " & x)
     
     
                If x = 880 Then
                    e.HasMorePages = True
                Else
                    e.HasMorePages = False
                End If
     
            Next
     
     
     
     
     
     
     
     
        End Sub

  6. #6
    Expert éminent Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 193
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 193
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    private i as integer = 0
    private x As Integer = 0 ' ca serait pas plutot un y ???
    private Ft1 = New Font("Times New Roman", 14, FontStyle.Regular)
     
     
        Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
     
     
            For i = i To ObjetDataTable.Rows.Count - 1
     
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("N°ligne").ToString, Ft1, New SolidBrush(Color.Black), 10, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Immatriculation").ToString, Ft1, New SolidBrush(Color.Black), 70, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Nom-de-lassuré").ToString, Ft1, New SolidBrush(Color.Black), 220, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Prenom-de-lassuré").ToString, Ft1, New SolidBrush(Color.Black), 380, x)
                e.Graphics.DrawString(ObjetDataTable.Rows(i).Item("Date-Naissance").ToString, Ft1, New SolidBrush(Color.Black), 530, x)
                e.Graphics.DrawString(Val(ObjetDataTable.Rows(i).Item("Montant-générale")).ToString("000.00"), Ft1, New SolidBrush(Color.Black), 770, x)
                x += 110
                MsgBox("x= " & x)
     
     
                If x = 880 Then
                    e.HasMorePages = True
                Else
                    e.HasMorePages = False
                    i = 0 
                    x = 0
                End If
     
            Next
     
     
         End Sub
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Débutant] Comment utiliser List dans mon code
    Par solaar dans le forum C#
    Réponses: 2
    Dernier message: 02/04/2013, 13h07
  2. comment utiliser engOutputBuffer dans un code C++
    Par DANIA511 dans le forum MATLAB
    Réponses: 0
    Dernier message: 01/01/2013, 23h02
  3. Réponses: 2
    Dernier message: 22/08/2006, 11h28
  4. Comment utiliser Opengl dans Visual Basic 6
    Par fun31 dans le forum OpenGL
    Réponses: 1
    Dernier message: 03/12/2004, 10h17
  5. [CR][VB6] comment utiliser CR dans VB ?
    Par kouassi_denis dans le forum SDK
    Réponses: 2
    Dernier message: 26/01/2004, 16h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo