Public Class Form13
    Dim db_informatique2 As New class2
    Dim db_informatique3 As New class3
    Dim nbr As New Integer
    Dim prg, prp As Double

    Private Sub Form13_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        t6.Focus()

    End Sub

    Private Sub t6_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles t6.KeyDown
        If e.KeyCode = Keys.Enter Then
            Button3.Focus()
        End If
    End Sub

    Private Sub t6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t6.TextChanged

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim test1 = 1
        db_informatique2.Myreq = "select*from factureachat where codep='" & t6.Text & "'"
        db_informatique2.Connecting_in_informatique()
        Do While db_informatique2.rdr.Read
            nbr = db_informatique2.rdr(4).ToString
            prg = db_informatique2.rdr(12).ToString
            prp = db_informatique2.rdr(6).ToString
            test1 = 0
        Loop
        db_informatique2.Disconnecting_in_informatique()

        If test1 = 0 And t6.Text <> "" Then
            db_informatique2.Myreq = "update factureachat set nbregpiece='" & nbr + 1 & "',prixg='" & prg + prp & "' where codep='" & t6.Text & "'"
            db_informatique2.Connecting_in_informatique()
            db_informatique2.Disconnecting_in_informatique()
            If MessageBox.Show("لقد تم ترجيع الصنف هل تريد المواصلة في الترجيع", "ترجيع", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = System.Windows.Forms.DialogResult.Yes Then
                t6.Text = ""
                t6.Focus()
            Else
                Me.Hide()
            End If

        Else
            MsgBox("هذا الصنف غير موجود", MsgBoxStyle.Exclamation, "تنبيه")
            t6.Text = ""
            t6.Focus()
        End If





    End Sub

    Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Enter Then
            Button3.Focus()
        End If
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub
End Class