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 :

Application VB.net trop lente !


Sujet :

VB.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre très actif
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2012
    Messages
    130
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Service public

    Informations forums :
    Inscription : Février 2012
    Messages : 130
    Par défaut Application VB.net trop lente !
    BonSoir ;
    J'ai px realiser une application Windows Form en vb.net 2008 qui fait la manipulation des Fichier Excel (Lecteur et Ecriture ) mai le problem s que qund j’exécute l'appli il prends bcp du temps avant de donner le résultats Final suitée

  2. #2
    Membre éclairé
    Homme Profil pro
    Responsable Maintenance
    Inscrit en
    Août 2012
    Messages
    479
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Responsable Maintenance

    Informations forums :
    Inscription : Août 2012
    Messages : 479
    Par défaut
    Si tu ouvres de multiples fichiers excel ca risque de prendre en effet du temps.
    J'ai fait quelque chose de similaire en ouvrant des fichiers excel et stockes les données dans un gridview sur 200 fichiers a 50 Mo le fichier ca fait long et c'est lourd.
    Les données n’étant pas ordonnées correctement et je piochais à droite , à gauche, je n'avais donc pas trop le choix.
    Si par contre tes données sont propres et rangées dans une table correctement tu peux plutôt faire une liaison OleDB vers excel pour la lecture des données. CA devrais aller plus vite en sauvegardant dans une table de ton dataset et ensuite réinjecter dans le fichier de destination.

  3. #3
    Membre éclairé Avatar de gnusti
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Février 2012
    Messages
    55
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2012
    Messages : 55
    Par défaut
    Bonjour,

    Il faut se pencher sur ton algo aussi, tu as peut-etre des boucles inutiles ou il est peut-être possible d'optimiser...

  4. #4
    Membre Expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2009
    Messages
    1 048
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2009
    Messages : 1 048
    Par défaut
    En premier lieu, je te recommande aussi d'utiliser ADO.NET et jet pour interfacer les fichiers Excel plutot que les interop d'office (si c'est pas déjà le cas). Après il est peut être possible de paralléliser certains traitements.

    Reste que l'ouverture de 200 * 50 Mo de fichier ça ne risque pas d'être rapide quelque soit la solution...

    Peut être que, d'un point de vue infrastructure logiciel, la création d'une application serveur (ou d'un service) s'occupant du traitement de ces fichiers en tâches de fond (la nuit par exemple) puis stockant le résultat de l'analyse dans un cache (une base de donnée) serait plus efficace.

    Difficile de dire avec les infos à dispo.

  5. #5
    Membre très actif
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2012
    Messages
    130
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Service public

    Informations forums :
    Inscription : Février 2012
    Messages : 130
    Par défaut
    Les Amis MERCI BCP ... Le partage ça fait du bien
    Voila une partie de mon code

    je travaille avec une STRUCTURE_T pour créer une tab dans la quelle je stock me donnée après les avoir traiter par l'intermédiaire de qlq fonction
    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
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
     '''''''''''''''''''     Overture
                    Dim fichier As String = OpenFileDialog1.FileName.ToString
                    xlap = New Excel.Application
                    cl = xlap.Workbooks.Open(fichier)
                    fl = cl.ActiveSheet
                    Try
                        Dim tab(fl.UsedRange.Rows.Count) As STRUCTURE_T
                        u = 0
                        'If fl.UsedRange.Rows.Count > 500 Then
                        '    Progressement.ProgressBar1.Maximum = 160
                        '    'Progressement.MdiParent = Controle
                        '    Progressement.ShowDialog()
                        'Else
                        '    Progressement.ProgressBar1.Maximum = 60
                        '    'Progressement.MdiParent = Controle
                        '    Progressement.ShowDialog()
                        'End If
                        '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                        '''''''''''''''     Partie Lecteur
                        Progressement.ShowDialog()
                        For i As Integer = 2 To fl.UsedRange.Rows.Count
                            tab(u).Date_integration = date_int.ToString
                            tab(u).FICHIER = fl.UsedRange.Cells(i, 12).text.ToString.Substring(0, 6)
                            tab(u).Num_CLI = fl.UsedRange.Cells(i, 1).text.ToString
                            tab(u).CIVILITE = civT(fl.UsedRange.Cells(i, 2).text.ToString)
                            tab(u).Nom = fl.UsedRange.Cells(i, 3).text.ToString
                            tab(u).PRENOM = fl.UsedRange.Cells(i, 4).text.ToString
                            tab(u).Ville = fl.UsedRange.Cells(i, 5).text.ToString
                            tab(u).Id_Pays = fl.UsedRange.Cells(i, 6).text.ToString
                            tab(u).tel1 = CBTEL1_FR(fl.UsedRange.Cells(i, 7).text.ToString).ToString
                            tab(u).tel2 = CBTEL2_FR(fl.UsedRange.Cells(i, 7).text.ToString).ToString
                            tab(u).DATE_ANC_CMD = fl.UsedRange.Cells(i, 8).text.ToString
                            tab(u).REF_COMMANDE = fl.UsedRange.Cells(i, 9).text.ToString
                            tab(u).TOTAL_ANC_CMD = fl.UsedRange.Cells(i, 10).text.ToString
                            tab(u).Code_Rejet = fl.UsedRange.Cells(i, 11).text.ToString
                            tab(u).DETAIL_CODE = dtailcode(fl.UsedRange.Cells(i, 11).text.ToString).ToString
                            tab(u).CODE_OPE = fl.UsedRange.Cells(i, 12).text.ToString
                            tab(u).COMMAND1 = fl.UsedRange.Cells(i, 13).text.ToString
                            tab(u).COMMAND2 = fl.UsedRange.Cells(i, 14).text.ToString
                            tab(u).COMMAND3 = fl.UsedRange.Cells(i, 15).text.ToString
                            tab(u).COMMAND4 = fl.UsedRange.Cells(i, 16).text.ToString
                            tab(u).COMMAND5 = fl.UsedRange.Cells(i, 17).text.ToString
                            tab(u).COMMAND6 = fl.UsedRange.Cells(i, 18).text.ToString
                            tab(u).Mode_Moyen_Reg = fl.UsedRange.Cells(i, 37).text.ToString
                            tab(u).MODE_PAIE = modemr(fl.UsedRange.Cells(i, 37).text.ToString)
                            Progressement.ProgressBar1.Value = CInt(i / fl.UsedRange.Rows.Count)
                            Label1.Text = i
     
                            u += 1
                        Next
                        cl.Close()
                        xlap.Quit()
                        '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                        '''''''''''''''    Partie Ecriteur
                        xlap2 = New Excel.Application
                        cl2 = xlap2.Workbooks.Add
                        fl2 = cl2.Sheets(1)
     
                        fl2.Cells(1, 1).value = "DATE_INTEGRATION"
                        fl2.Cells(1, 2).value = "FICHIER"
                        fl2.Cells(1, 3).value = "Num_CLI"
                        fl2.Cells(1, 4).value = "CIVILITE"
                        fl2.Cells(1, 5).value = "Nom"
                        fl2.Cells(1, 6).value = "PRENOM"
                        fl2.Cells(1, 7).value = "Ville"
                        fl2.Cells(1, 8).value = "Id_Pays"
                        fl2.Cells(1, 9).value = "TEL"
                        fl2.Cells(1, 10).value = "TEL2"
                        fl2.Cells(1, 11).value = "DATE_ANC_CMD"
                        fl2.Cells(1, 12).value = "REF_COMMANDE"
                        fl2.Cells(1, 13).value = "TOTAL_ANC_CMD"
                        fl2.Cells(1, 14).value = "Code_Rejet"
                        fl2.Cells(1, 15).value = "DETAIL_CODE"
                        fl2.Cells(1, 16).value = "CODE_OPE"
                        fl2.Cells(1, 17).value = "COMMAND1"
                        fl2.Cells(1, 18).value = "COMMAND2"
                        fl2.Cells(1, 19).value = "COMMAND3"
                        fl2.Cells(1, 20).value = "COMMAND4"
                        fl2.Cells(1, 21).value = "COMMAND5"
                        fl2.Cells(1, 22).value = "COMMAND6"
                        fl2.Cells(1, 23).value = "Mode_Moyen_Reg"
                        fl2.Cells(1, 24).value = "MODE_PAIE"
                        For j As Integer = 0 To UBound(tab)
                            For c As Integer = 1 To 24
                                fl2.Cells(j + 2, c).NumberFormat = "@"
                                fl2.Cells(j + 2, 1) = tab(j).Date_integration
                                fl2.Cells(j + 2, 2) = tab(j).FICHIER
                                fl2.Cells(j + 2, 3) = tab(j).Num_CLI
                                fl2.Cells(j + 2, 4) = tab(j).CIVILITE
                                fl2.Cells(j + 2, 5) = tab(j).Nom
                                fl2.Cells(j + 2, 6) = tab(j).PRENOM
                                fl2.Cells(j + 2, 7) = tab(j).Ville
                                fl2.Cells(j + 2, 8) = tab(j).Id_Pays
                                fl2.Cells(j + 2, 9) = tab(j).tel1
                                fl2.Cells(j + 2, 10) = tab(j).tel2
                                fl2.Cells(j + 2, 11) = tab(j).DATE_ANC_CMD
                                fl2.Cells(j + 2, 12) = tab(j).REF_COMMANDE
                                fl2.Cells(j + 2, 13) = tab(j).TOTAL_ANC_CMD
                                fl2.Cells(j + 2, 14) = tab(j).Code_Rejet
                                fl2.Cells(j + 2, 15) = tab(j).DETAIL_CODE
                                fl2.Cells(j + 2, 16) = tab(j).CODE_OPE
                                fl2.Cells(j + 2, 17) = tab(j).COMMAND1
                                fl2.Cells(j + 2, 18) = tab(j).COMMAND2
                                fl2.Cells(j + 2, 19) = tab(j).COMMAND3
                                fl2.Cells(j + 2, 20) = tab(j).COMMAND4
                                fl2.Cells(j + 2, 21) = tab(j).COMMAND5
                                fl2.Cells(j + 2, 22) = tab(j).COMMAND6
                                fl2.Cells(j + 2, 23) = tab(j).Mode_Moyen_Reg
                                fl2.Cells(j + 2, 24) = tab(j).MODE_PAIE
                            Next
     
                        Next
                        If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
                            fl2.SaveAs(SaveFileDialog1.FileName.ToString)
                            Dim ovrxl As Excel.Application
                            Dim ovrcl As Excel.Workbook
                            Dim ovrsh As Excel.Worksheet
                            ovrxl = New Excel.Application
                            ovrcl = ovrxl.Workbooks.Open(SaveFileDialog1.FileName.ToString)
                            ovrsh = ovrcl.Worksheets(1)
                            ovrxl.Visible = True
                            xlap2.Quit()
                        End If
                        '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                    Catch ex As Exception
                        MsgBox(ex.ToString)
                    End Try
                    ''''''''''''''''''''''  CBR UK
                    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  6. #6
    Membre Expert
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2010
    Messages
    793
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Novembre 2010
    Messages : 793
    Par défaut
    Bonjour,

    voyez donc comme proposé dans le commentaire du dessus, avec ADO.NET

  7. #7
    Membre très actif
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2012
    Messages
    130
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Service public

    Informations forums :
    Inscription : Février 2012
    Messages : 130
    Par défaut
    Les amis plus d'explication selvous pler

  8. #8
    Membre très actif
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2012
    Messages
    130
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Service public

    Informations forums :
    Inscription : Février 2012
    Messages : 130
    Par défaut
    sinople ton aide m'interesse bien Merci de me donner un petit exemple concret SVP Merci pour votre cooperation

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

Discussions similaires

  1. Requête BD trop lente => Arrêt du processus ASP.NET
    Par sk8world dans le forum ASP.NET
    Réponses: 1
    Dernier message: 14/04/2010, 15h25
  2. Réponses: 1
    Dernier message: 20/05/2008, 18h05
  3. Visual Studio 2005 VB.Net Trop lent
    Par Lebeb dans le forum Visual Studio
    Réponses: 7
    Dernier message: 15/05/2008, 15h54
  4. [VB.NET 2005 XE] automation MSWORD trop lente
    Par kinganasius dans le forum Windows Forms
    Réponses: 1
    Dernier message: 27/03/2007, 14h21
  5. [vb.net 2005] automation MS word trop lente !
    Par kinganasius dans le forum Windows Forms
    Réponses: 1
    Dernier message: 27/03/2007, 14h14

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