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 :

Débutant en Vb.net


Sujet :

VB.NET

  1. #1
    Membre très actif
    Homme Profil pro
    Tutulaire d'un Master Academique en Réseaux et Systèmes repartis
    Inscrit en
    Juin 2011
    Messages
    227
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Algérie

    Informations professionnelles :
    Activité : Tutulaire d'un Master Academique en Réseaux et Systèmes repartis
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2011
    Messages : 227
    Par défaut Débutant en Vb.net
    Salut tous le monde, je suis débutant en VB.Net et j'ai cette procédure qui ne marche pas bien. J'aimerais bien que vous m'aidiez à comprendre bien cette procédure.


    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
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    Private Sub BtEditer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtEditer.Click
            Listes = New List(Of String)
            Lis = New List(Of String)
            A = New List(Of String)
            B = New List(Of String)
            C = New List(Of String)
            D = New List(Of String)
            G = New List(Of String)
            F = New List(Of String)
     
            G1 = New List(Of String)
            G2 = New List(Of String)
            G3 = New List(Of String)
            G4 = New List(Of String)
     
            C1 = New List(Of String)
            C2 = New List(Of String)
            C3 = New List(Of String)
            C4 = New List(Of String)
     
            Dim Imp As New Imprimer
            Dim ic As New Decompte
     
            For Each Utilist As DataGridViewRow In Me.DGV_EtatDesFrais.Rows
     
     
                    If Utilist.Cells(3).Value = "MISSION" Then
                        Lis.Add(Utilist.Cells(1).Value)
                        If Utilist.Cells(9).Value <= 0 Then
                            A.Add(Utilist.Cells(1).Value)
     
                        Else
                            B.Add(Utilist.Cells(1).Value)
                            If Utilist.Cells(11).Value = "2" Then
                                C1.Add(Utilist.Cells(11).Value)
                                C2.Add(Utilist.Cells(1).Value)
                            ElseIf Utilist.Cells(11).Value = "1" Then
                                C3.Add(Utilist.Cells(11).Value)
                                C4.Add(Utilist.Cells(1).Value)
                            End If
                        End If
     
            ElseIf Utilist.Cells(3).Value = "DEPLACEMENT" Then
                        Listes.Add(Utilist.Cells(1).Value)
     
                        If Utilist.Cells(9).Value <= 0 Then  '<=
                            D.Add(Utilist.Cells(1).Value)
     
                        Else
                            F.Add(Utilist.Cells(1).Value)
                            If Utilist.Cells(11).Value = "2" Then
                                G1.Add(Utilist.Cells(11).Value)
                                G2.Add(Utilist.Cells(1).Value)
                            ElseIf Utilist.Cells(11).Value = "1" Then
                                G3.Add(Utilist.Cells(11).Value)
                                G4.Add(Utilist.Cells(1).Value)
                            End If
     
     
                        End If
     
                    End If
     
                End If
            Next
     
            If Listes.Count > 0 Or Lis.Count > 0 Then
                Dim message As String
                If Listes.Count = 1 Or Lis.Count = 1 Then
                    message = "Voulez vous Editer L'Etat des Frais de Mission :" & vbCrLf & Me.DGV_EtatDesFrais.CurrentRow.Cells(1).Value & "?"
                Else
                    message = "Voulez vous Editer L'Etat des Frais de Mission ?"
                End If
     
                If MsgBox(message, MsgBoxStyle.OkCancel) = MsgBoxResult.Ok Then
     
                    If A.Count > 0 Then
     
                        Dim inc As New Decompte
                        Dim numero As String = inc.IncNumRecapMIss(Year(Today), "3", "MISSION")
     
                        For Each util In A
                            NUtilisateur = util
                            inc.InsertNumRecap(NUtilisateur, numero, Connexion)
                        Next
     
     
                        inc.InsertNumRecapTablevalid(numero, Connexion)
                        Imp.EditerRecapMissRemb(A)
     
     
                    End If
     
                    If B.Count > 0 Then
                        For Each util In C1
                            Dim inc As New Decompte
                            numero = inc.IncNumRecapMIss(Year(Today), "2", "MISSION")
                        Next
                        For Each util In C2
                            NUtilisateur = util
                            ic.InsertNumRecap(NUtilisateur, numero, Connexion)
                        Next
     
                        For Each util In C3
                            Dim inc As New Decompte
                            num = inc.IncNumRecapMIss(Year(Today), "1", "MISSION")
                            numero = num
                        Next
                        For Each util In C4
                            NUtilisateur = util
                            ic.InsertNumRecap(NUtilisateur, num, Connexion)
                        Next
     
     
     
                        Dim Ip As New Imprimer
                        ic.InsertNumRecapTablevalid(numero, Connexion)
                        Ip.EditerRecapMiss(B)
     
                    End If
     
     
                    If D.Count > 0 Then
                        Dim inc As New Decompte
                        Dim numero As String = inc.IncNumRecap(Year(Today), "3", "DEPLACEMENT")
                        For Each util In D
                            NUtilisateur = util
                            inc.InsertNumRecap(NUtilisateur, numero, Connexion)
                        Next
                        ic.InsertNumRecapTablevalid(numero, Connexion)
                        Imp.EditerRecapDepRem(D)
                    End If
     
     
     
                    If F.Count > 0 Then
                        For Each util In G1
                            Dim inc As New Decompte
                            numero = inc.IncNumRecap(Year(Today), "2", "DEPLACEMENT")
                        Next
                        For Each util In G2
                            NUtilisateur = util
                            ic.InsertNumRecap(NUtilisateur, numero, Connexion)
                        Next
     
                        For Each util In G3
                            Dim inc As New Decompte
                            numero = inc.IncNumRecap(Year(Today), "1", "DEPLACEMENT")
                            num = numero
                        Next
                        For Each util In G4
                            NUtilisateur = util
                            ic.InsertNumRecap(NUtilisateur, num, Connexion)
                        Next
                        ic.InsertNumRecapTablevalid(numero, Connexion)
     
                        Imp.EditerRecapDep(F)
                    End If
     
     
                    Dim ListeLigneEdit As New List(Of DataGridViewRow)
                    For Each Ligne As DataGridViewRow In Me.DGV_EtatDesFrais.Rows
                        If Ligne.Cells(0).Value Then
                            ListeLigneEdit.Add(Ligne)
                        End If
                    Next
                    If ListeLigneEdit.Count <> 0 Then
                        For Each Ligne As DataGridViewRow In ListeLigneEdit
                            Me.DGV_EtatDesFrais.Rows.Remove(Ligne)
                        Next
                    End If
                End If
            Else
                MsgBox("Vous devez sélectionner au moins une Décompte", MsgBoxStyle.Information)
                Exit Sub
            End If
        End Sub

  2. #2
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Mai 2012
    Messages
    58
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2012
    Messages : 58
    Par défaut
    Salut BM,

    Tu veux comprendre le fonctionnement du code que tu soumets ?

    cordialement,

    Madfox

  3. #3
    Membre expérimenté Avatar de Delaney
    Homme Profil pro
    Developpeur VB amateur
    Inscrit en
    Mars 2014
    Messages
    148
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Developpeur VB amateur
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Mars 2014
    Messages : 148
    Par défaut
    Bonsoir,

    Citation Envoyé par bm1990 Voir le message
    Salut tous le monde, je suis débutant en VB.Net et j'ai cette procédure qui ne marche pas bien. J
    Questions : qu'est ce qui ne marche pas bien? as tu des erreurs? lesquels? qu'est que cela devrait faire et que cela ne fait pas (ou l'inverse) ?

    remarque : ici est ce que " listes , lis, et a->F, Gx et Cx " sont bien déclarées par des dim ailleurs? sinon déjà là ça ne peut pas fonctionner...

    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
    Private Sub BtEditer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtEditer.Click
            Listes = New List(Of String)
            Lis = New List(Of String)
            A = New List(Of String)
            B = New List(Of String)
            C = New List(Of String)
            D = New List(Of String)
            G = New List(Of String)
            F = New List(Of String)
     
            G1 = New List(Of String)
            G2 = New List(Of String)
            G3 = New List(Of String)
            G4 = New List(Of String)
     
            C1 = New List(Of String)
            C2 = New List(Of String)
            C3 = New List(Of String)
            C4 = New List(Of String)
     
            Dim Imp As New Imprimer
            Dim ic As New Decompte
    [

    tu devrais avoir par exemple
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    dim  Listes as New List(Of String)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    If B.Count > 0 Then
                        For Each util In C1
                            Dim inc As New Decompte 
                            numero = inc.IncNumRecapMIss(Year(Today), "2", "MISSION") 'l'objet "inc" c'est que des méthodes? sinon , il faut peut-être lui affecter quelque chose avant de l'utiliser?
                        Next
                        For Each util In C2
                            NUtilisateur = util
                           ic.InsertNumRecap(NUtilisateur, numero, Connexion) 
                        Next
    sans connaitre ce qu'il y a dans l'objet "decompte", c'est pas facile de savoir ce qui ne va pas.

    Sincèrement

Discussions similaires

  1. question de débutant en asp.net
    Par fedia76 dans le forum ASP.NET
    Réponses: 1
    Dernier message: 04/06/2009, 09h53
  2. Réponses: 2
    Dernier message: 07/01/2008, 11h46
  3. débutant sur VB.NET
    Par houssamnat dans le forum VB.NET
    Réponses: 2
    Dernier message: 04/01/2008, 23h24
  4. Questions débutants sur vb.net?
    Par naima2005 dans le forum VB.NET
    Réponses: 1
    Dernier message: 18/12/2007, 20h12
  5. [Débutant(e)][VB.NET] Drag and drop entre 2 treeviews
    Par - Manuella Leray - dans le forum Windows Forms
    Réponses: 8
    Dernier message: 13/10/2005, 15h54

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