Salut le forum j'ai un formulé qui comporte deux datagridview l'un lié à la base de données 'dgvProduit' et l'autre qui doit récupéré les données 'dgvVente' puis un testBox qui me permet de stocké la valeur du code barre scanner.
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
Private Sub txtBar_TextChanged(sender As Object, e As EventArgs) Handles txtBar.TextChanged
        Try
 
            Call Connecter()
 
            Dim da = New SqlDataAdapter(" SET LANGUAGE FRENCH
SELECT A.IdClients as IdClients,C.Nom AS Client,A.[Idarticle] AS [Idarticle],B.IdRayon AS IdRayon,B.Designation As Article
,(CAST( A.[Idarticle] AS bigint)*99999) AS [Idarticlebarcode], 1 as Qte,A.Pu AS Pu
FROM [dbo].[Prixvente] A
INNER JOIN [dbo].[article] B ON B.Idarticle=A.Idarticle
INNER JOIN [dbo].[Clients] C ON C.IdClients=A.IdClients
where C.Nom='" & cmbstation.Text & "' AND (CAST( A.[Idarticle] AS bigint)*99999) = '" & txtBar.Text.ToString & "'", con)
            Dim ds As New DataSet
            da.Fill(ds, "[A]")
 
            dgvProduits.DataSource = ds.Tables(0)
            ds.Dispose()
            dgvVentesP.AllowUserToAddRows = False
            dgvVentesP.Rows.Add(dgvProduits.Rows(0).Cells("IdClients").Value, dgvProduits.Rows(0).Cells("Client").Value, dgvProduits.Rows(0).Cells("Idarticle").Value, dgvProduits.Rows(0).Cells("IdRayon").Value,
                         dgvProduits.Rows(0).Cells("Article").Value, dgvProduits.Rows(0).Cells("Idarticlebarcode").Value, dgvProduits.Rows(0).Cells("Qte").Value, dgvProduits.Rows(0).Cells("Pu").Value)
 
            Call deconnecter()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
 
        If txtBar.Text <> "" Then
            txtTEST.Text = txtBar.Text
        End If
 
        Try
 
 
            Dim sum As Decimal = 0
            For i As Integer = 0 To dgvVentesP.Rows.Count - 1
                sum += dgvVentesP.Rows(i).Cells(7).Value
            Next
            lblTotal.Text = sum
        Catch ex As Exception
 
        End Try
 
 
    End Sub
le problème est que après chaque scanne, j'ai plusieurs lignes vide qui s'ajoute.
Nom : SCANNEBARRE.png
Affichages : 169
Taille : 28,2 Ko
La grande question est comment corrigé se problème?