Application de Gestion Pharmaceutique Avec Visual Basic
Application de Gestion Pharmaceutique Avec Visual Basic
net
Bouton commander
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
On Error GoTo etiq
Me.Hide()
Commande.Show()
Commande.TextBox1.Text = Me.TextBox1.Text
Commande.TextBox4.Text = Me.TextBox2.Text
Commande.TextBox5.Text = Me.TextBox3.Text
Commande.TextBox7.Text = Me.TextBox5.Text
Commande.TextBox9.Text = Me.TextBox4.Text
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
End Sub
Bouton rechercher
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
On Error GoTo etiq
Dim reqrech As New OleDb.OleDbCommand
Dim reqrech2 As New OleDb.OleDbCommand
Dim datreadrech, datreadrech2 As OleDb.OleDbDataReader
reqrech.Connection = cn
reqrech.CommandType = CommandType.Text
reqrech.CommandText = "select * from Mdicament where CodeMedicament = '" & TextBox1.Text & "'"
datreadrech = reqrech.ExecuteReader
reqrech2.Connection = cn
reqrech2.CommandType = CommandType.Text
reqrech2.CommandText = "select * from stockmed where CodeMedicament = '" & TextBox1.Text & "'"
datreadrech2 = reqrech2.ExecuteReader
If Not datreadrech.HasRows Then
MsgBox("Le numro du mdicament recherch n'existe pas ", MsgBoxStyle.Exclamation, "Opration
de recherche")
Else
MsgBox("La recherche est fructueuse !", MsgBoxStyle.Information, "Opration de recherche")
datreadrech.Read()
TextBox1.Text = datreadrech.GetValue(0)
TextBox2.Text = datreadrech.GetValue(2)
TextBox3.Text = datreadrech.GetValue(1)
TextBox4.Text = datreadrech.GetValue(3)
datreadrech2.Read()
TextBox5.Text = datreadrech2.GetValue(0)
End If
datreadrech.Close()
datreadrech2.Close()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans :" &
.Source)
End With
End Sub
Bouton modifier
Bouton supprimer
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
On Error GoTo etiq
Dim reqsuppr As New OleDb.OleDbCommand
Dim reqsuppr1 As New OleDb.OleDbCommand
Dim reqsuppr2 As New OleDb.OleDbCommand
Dim reqsuppr3 As New OleDb.OleDbCommand
Dim reqmod As New OleDb.OleDbCommand
reqsuppr1.Connection = cn
reqsuppr1.CommandType = CommandType.Text
reqsuppr1.CommandText = "delete * from commandemed where codemdicament='" & TextBox1.Text
& "'"
reqsuppr1.ExecuteNonQuery()
reqsuppr2.Connection = cn
reqsuppr2.CommandType = CommandType.Text
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
reqsuppr2.CommandText = "delete * from stockmed where codemedicament='" & TextBox1.Text & "'"
reqsuppr2.ExecuteNonQuery()
reqsuppr3.Connection = cn
reqsuppr3.CommandType = CommandType.Text
reqsuppr3.CommandText = "delete * from ventemed where codemdicament='" & TextBox1.Text & "'"
reqsuppr3.ExecuteNonQuery()
reqsuppr.Connection = cn
reqsuppr.CommandType = CommandType.Text
reqsuppr.CommandText = "delete * from mdicament where codemedicament='" & TextBox1.Text &
"'"
reqsuppr.ExecuteNonQuery()
MsgBox("L'opration de suppression est effctue avec succs !", MsgBoxStyle.Information, "
Opration de suppression")
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton rinitialiser
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button7.Click
On Error GoTo etiq
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
ListBox1.Items.Clear()
datread.Close()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton Quitter
Bouton choisir
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button6.Click
On Error GoTo etiq
Me.Hide()
famille.Show()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans :" &
.Source)
End With
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
GroupBox1.Enter
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Timer1.Tick
Label1.Left = Label1.Left - 10
If Label1.Left < 0 Then
Label1.Left = 280
End If
End Sub
End Class
Bouton rinitialiser
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
On Error GoTo etiq
ListBox1.Items.Clear()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
datread.Close()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Private Sub Commande_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
End Sub
Bouton quitter
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
On Error GoTo etiq
Me.Hide()
Mdicament.Show()
Exit Sub
etiq:
With Err()
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton valider
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
On Error GoTo etiq
Mdicament.TextBox3.Text = Me.TextBox1.Text
Me.Hide()
Mdicament.Show()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton quitter
Bouton afficher
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
On Error GoTo etiq
req.Connection = cn
req.CommandType = CommandType.Text
req.CommandText = "select * from fournisseur"
datread = req.ExecuteReader
If Not datread.HasRows Then
MsgBox("La table est vide !", MsgBoxStyle.Exclamation, "Opration d'affichage")
Else
Do While datread.Read
ListBox1.Items.Add(datread.GetValue(0) & "---" & datread.GetValue(1) & "---" &
datread.GetValue(2) & "---" & datread.GetValue(3) & "---" & datread.GetValue(4))
Loop
End If
datread.Close()
Exit Sub
etiq:
With Err()
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Private Sub Fournisseur_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
On Error GoTo etiq
If cn.State = ConnectionState.Closed Then
Call connect()
End If
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton ajouter
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
On Error GoTo etiq
Dim reqajout As New OleDb.OleDbCommand
reqajout.Connection = cn
reqajout.CommandType = CommandType.Text
reqajout.CommandText = "insert into fournisseur values('" & TextBox1.Text & "','" & TextBox2.Text &
"','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "')"
reqajout.ExecuteNonQuery()
MsgBox("L'opration d'ajout est effctue avec succs!", MsgBoxStyle.Information, "Opration
d'ajout")
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton rechercher
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
On Error GoTo etiq
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
Dim reqrech As New OleDb.OleDbCommand
Dim datreadrech As OleDb.OleDbDataReader
reqrech.Connection = cn
reqrech.CommandType = CommandType.Text
reqrech.CommandText = "select * from Fournisseur where CodeFournisseur = '" & TextBox1.Text & "'"
datreadrech = reqrech.ExecuteReader
If Not datreadrech.HasRows Then
MsgBox("Le numro du fournisseur recherch n'existe pas ", MsgBoxStyle.Exclamation, "Opration
de recherche")
Else
MsgBox("La recherche est fructueuse !", MsgBoxStyle.Information, "Opration de recherche")
datreadrech.Read()
TextBox1.Text = datreadrech.GetValue(0)
TextBox2.Text = datreadrech.GetValue(1)
TextBox3.Text = datreadrech.GetValue(2)
TextBox4.Text = datreadrech.GetValue(3)
TextBox5.Text = datreadrech.GetValue(4)
End If
datreadrech.Close()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton modifier
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
On Error GoTo etiq
Dim reqmodif As New OleDb.OleDbCommand
reqmodif.Connection = cn
reqmodif.CommandType = CommandType.Text
reqmodif.CommandText = "update Fournisseur set Nom='" & TextBox2.Text & "',Adresse='" &
TextBox3.Text & "',Ville='" & TextBox4.Text & "',Tl='" & TextBox5.Text & "'where codefournisseur ='" &
TextBox1.Text & "'"
reqmodif.ExecuteNonQuery()
MsgBox("L'opration de modification est effctue avec succs!", MsgBoxStyle.Information, "Opration
de modification")
Exit Sub
etiq:
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton supprimer
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
On Error GoTo etiq
Dim reqsuppr As New OleDb.OleDbCommand
reqsuppr.Connection = cn
reqsuppr.CommandType = CommandType.Text
reqsuppr.CommandText = "delete * from Fournisseur where CodeFournisseur='" & TextBox1.Text & "'"
reqsuppr.ExecuteNonQuery()
MsgBox("L'opration de suppression est effctue avec succs!", MsgBoxStyle.Information, "Opration
de suppression")
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton rinitialiser
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button6.Click
On Error GoTo etiq
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text() = ""
TextBox5.Text = ""
ListBox1.Items.Clear()
datread.Close()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
End Sub
Bouton quitter
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button7.Click
On Error GoTo etiq
Me.Hide()
MdiParent.Show()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Timer1.Tick
Label6.Left = Label6.Left - 10
If Label6.Left < 0 Then
Label6.Left = 280
End If
End Sub
End Class
Bouton quitter
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button6.Click
On Error GoTo etiq
Me.Hide()
MdiParent.Show()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton ajouter
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
On Error GoTo etiq
Dim reqajout As New OleDb.OleDbCommand
Dim reqajout1 As New OleDb.OleDbCommand
reqajout.Connection = cn
reqajout.CommandType = CommandType.Text
reqajout.CommandText = "insert into stock values('" & TextBox1.Text & "','" & Val(TextBox2.Text) &
"')"
reqajout1.Connection = cn
reqajout1.CommandType = CommandType.Text
reqajout1.CommandText = "insert into stockmed values('" & TextBox1.Text & "','" & TextBox3.Text &
"','" & Val(TextBox4.Text) & " ')"
reqajout.ExecuteNonQuery()
reqajout1.ExecuteNonQuery()
MsgBox("L'opration d'ajout est effctue avec succs!", MsgBoxStyle.Information, "Opration
d'ajout")
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
End Sub
Bouton rechercher
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
On Error GoTo etiq
Dim reqrech As New OleDb.OleDbCommand
Dim datreadrech, datreadrech1 As OleDb.OleDbDataReader
Dim reqrech2 As New OleDb.OleDbCommand
reqrech2.Connection = cn
reqrech.CommandType = CommandType.Text
reqrech2.CommandText = "select * from Stockmed where numstock = '" & TextBox1.Text & "'"
reqrech.Connection = cn
reqrech.CommandType = CommandType.Text
reqrech.CommandText = "select * from Stock where numstock = '" & TextBox1.Text & "'"
datreadrech1 = reqrech2.ExecuteReader
datreadrech = reqrech.ExecuteReader
If Not datreadrech.HasRows Then
MsgBox("Le numro du stock recherch n'existe pas!", MsgBoxStyle.Exclamation, "Opration de
recherche")
Else
MsgBox("La recherche est fructueuse !", MsgBoxStyle.Information, "Opration de recherche")
datreadrech.Read()
TextBox1.Text = datreadrech.GetValue(0)
TextBox2.Text = datreadrech.GetValue(1)
datreadrech1.Read()
TextBox1.Text = datreadrech1.GetValue(0)
TextBox3.Text = datreadrech1.GetValue(1)
TextBox4.Text = datreadrech1.GetValue(2)
End If
datreadrech.Close()
datreadrech1.Close()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton supprimer
Bouton rinitialiser
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button7.Click
On Error GoTo etiq
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ListBox1.Items.Clear()
datread.Close()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Timer1.Tick
Label1.Left = Label1.Left - 10
If Label1.Left < 0 Then
Label1.Left = 280
End If
End Sub
End Class
Exit Sub
End Sub
Private Sub Vente_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
On Error GoTo etiq
If cn.State = ConnectionState.Closed Then
Call connect()
End If
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton quitter
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
On Error GoTo etiq
Me.Hide()
MdiParent.Show()
Exit Sub
etiq:
With Err()
Bouton rinitialiser
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
On Error GoTo etiq
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
ListBox1.Items.Clear()
datread.Close()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton OK
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
On Error GoTo etiq
Dim reqlog As New OleDb.OleDbCommand
Dim datlog As OleDb.OleDbDataReader
reqlog.Connection = cn
reqlog.CommandType = CommandType.Text
reqlog.CommandText = "select * from utilisateur where login = '" & TextBox1.Text & "'and password
='" & TextBox2.Text & "'"
datlog = reqlog.ExecuteReader
datlog.Read()
If Not datlog.HasRows Then
MsgBox("le nom d'utilisateur ou mot de passe invalide", MsgBoxStyle.Information)
Else
Pharmacie.Show()
Me.Hide()
TextBox1.Text = ""
TextBox2.Text = ""
End If
Plus de projets sur: www.cour2.blogspot.com
Application de gestion pharmaceutique avec Visual Basic .net
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Bouton annuler
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
On Error GoTo etiq
Me.Close()
Exit Sub
etiq:
With Err()
MsgBox("Erreur no:" & .Number & vbCrLf & "description :" & .Description & vbCrLf & "Apparu dans
:" & .Source)
End With
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Call connect()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Timer1.Tick
Label3.Left = Label3.Left - 10
If Label3.Left < 0 Then
Label3.Left = 280
End If
End Sub
End Class