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 :

Impression datagridview matricielle


Sujet :

VB.NET

  1. #1
    Membre actif
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2011
    Messages
    267
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 267
    Points : 212
    Points
    212
    Par défaut Impression datagridview matricielle
    Bonsoir,

    Je souhaiterai savoir si je peux ajouter un bouton qui permet d'imprimer mon datagridview avec une imprimante matricielle non pas jet d'encre. Comment faire ?

    Merci de m'aider

  2. #2
    Expert éminent Avatar de Graffito
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    5 993
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 993
    Points : 7 903
    Points
    7 903
    Par défaut
    Décomposons le problème en 2 étapes:
    1. Le plus facile : transformer le datagridView en un fichier texte affichable via le bloc-note.
    2. Plus compliqué : imprimer ce fichier texte sur l'imprimante matricielle.
    Pour l'étape 2), voici des solutions :
    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
     
    internal static bool PrintDocument(string FileName,string MatricePrinterName)
    { 
       bool Result=false ;
       if (!System.IO.File.Exists(FileName)) 
             MessageBox.Show("File to be printed was not found : "+FileName) ;
       else try
       {
          System.Diagnostics.Process TheProcess = new System.Diagnostics.Process() ;
          TheProcess.StartInfo.FileName = FileName ;
          TheProcess.StartInfo.Verb    = "Printto" ;
          TheProcess.StartInfo.Arguments= MatricePrinterName ;
          TheProcess.StartInfo.CreateNoWindow = true ;
          TheProcess.Start() ;
          Result=true ;
       }
       catch (Exception Ex) 
       {
          MessageBox.Show("File print error on "+
                    FileName+Environment.NewLine+Ex.Message.ToString()) ; 
        }
       return Result ;
     }
    " Le croquemitaine ! Aaaaaah ! Où ça ? " ©Homer Simpson

  3. #3
    Membre actif
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2011
    Messages
    267
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 267
    Points : 212
    Points
    212
    Par défaut
    Citation Envoyé par Graffito Voir le message
    Décomposons le problème en 2 étapes:
    1. Le plus facile : transformer le datagridView en un fichier texte affichable via le bloc-note.
    2. Plus compliqué : imprimer ce fichier texte sur l'imprimante matricielle.
    Pour l'étape 2), voici des solutions :
    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
     
    internal static bool PrintDocument(string FileName,string MatricePrinterName)
    { 
       bool Result=false ;
       if (!System.IO.File.Exists(FileName)) 
             MessageBox.Show("File to be printed was not found : "+FileName) ;
       else try
       {
          System.Diagnostics.Process TheProcess = new System.Diagnostics.Process() ;
          TheProcess.StartInfo.FileName = FileName ;
          TheProcess.StartInfo.Verb    = "Printto" ;
          TheProcess.StartInfo.Arguments= MatricePrinterName ;
          TheProcess.StartInfo.CreateNoWindow = true ;
          TheProcess.Start() ;
          Result=true ;
       }
       catch (Exception Ex) 
       {
          MessageBox.Show("File print error on "+
                    FileName+Environment.NewLine+Ex.Message.ToString()) ; 
        }
       return Result ;
     }
    Mais moi j'ai une application VB.NET , est ce que pour la première méthode du bloc note:est ce que je peut créer un bouton qui utilise le bloc note sans que l'utilisateur ne voie rien pour imprimer?
    est pour la deuxième méthode comment je peux utisliser le c# et moi je travail sur VB.NET?

  4. #4
    Expert éminent Avatar de Graffito
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    5 993
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 993
    Points : 7 903
    Points
    7 903
    Par défaut
    Désolé j'avais pas fait attention à Vb/C#.

    Pour la première méthode il faut trouver un code équivalent enVb.

    Pour la 2ème, c'est pareil en Vb qu'en C# : on créée un objet de type System.Diagnostics.Process et on initialise certaines de ses valeurs.
    " Le croquemitaine ! Aaaaaah ! Où ça ? " ©Homer Simpson

  5. #5
    Membre actif
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2011
    Messages
    267
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 267
    Points : 212
    Points
    212
    Par défaut
    Citation Envoyé par Graffito Voir le message
    Désolé j'avais pas fait attention à Vb/C#.

    Pour la première méthode il faut trouver un code équivalent enVb.

    Pour la 2ème, c'est pareil en Vb qu'en C# : on créée un objet de type System.Diagnostics.Process et on initialise certaines de ses valeurs.
    Merci mais je suis débutant comment je peux faire la deuxième méthode

  6. #6
    Expert éminent Avatar de Graffito
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    5 993
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 993
    Points : 7 903
    Points
    7 903
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    Dim TheProcess As System.Diagnostics.Process = New System.Diagnostics.Process()
    TheProcess.StartInfo.FileName = ...
    Mais auparavant, faire un test consistant à ouvrir un fichier texte avec le bloc-note et l'imprimer sur l'imp matricielle, et si ça marche ...
    " Le croquemitaine ! Aaaaaah ! Où ça ? " ©Homer Simpson

  7. #7
    Membre actif
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2011
    Messages
    267
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 267
    Points : 212
    Points
    212
    Par défaut
    Citation Envoyé par Graffito Voir le message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    Dim TheProcess As System.Diagnostics.Process = New System.Diagnostics.Process()
    TheProcess.StartInfo.FileName = ...
    Mais auparavant, faire un test consistant à ouvrir un fichier texte avec le bloc-note et l'imprimer sur l'imp matricielle, et si ça marche ...
    Merci ,mais je vais l'essayé tous d'abord et je te répond.

  8. #8
    Membre actif
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2011
    Messages
    267
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 267
    Points : 212
    Points
    212
    Par défaut
    J'ai vu sur google le crystal report je pense qu'il permet d'imprimer sur imprimante matricielle mais le problème que je suis débutant j'ai rien compris qu'est ce que le crystal report et comment je peux l'utiliser pour imprimer un datagridviw et quelques label.

Discussions similaires

  1. [CR]Impression matricielle
    Par chess132 dans le forum SAP Crystal Reports
    Réponses: 2
    Dernier message: 13/03/2014, 10h14
  2. [Débutant] problème d'impression datagridview
    Par ozthewizard dans le forum VB.NET
    Réponses: 0
    Dernier message: 26/10/2011, 11h39
  3. impression datagridview vb 2008
    Par cath2123 dans le forum VB.NET
    Réponses: 1
    Dernier message: 08/10/2010, 13h51
  4. Impression dataGridView avec PrintDocument
    Par Le gris dans le forum C#
    Réponses: 6
    Dernier message: 16/04/2010, 10h08
  5. [CR] Ou trouver la réponse au PB "Impression matriciell
    Par leyra dans le forum SAP Crystal Reports
    Réponses: 2
    Dernier message: 18/04/2005, 16h13

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