I need a help
Résolu
sooprano
Messages postés
33
Date d'inscription
Statut
Membre
Dernière intervention
-
sooprano Messages postés 33 Date d'inscription Statut Membre Dernière intervention -
sooprano Messages postés 33 Date d'inscription Statut Membre Dernière intervention -
Bonjour, je trvaille sur Visual basic 6 et j devellope une application et j me suis tombé sur un p'tit Probleme
c'est ke j'ai un form2 par Exemple j'ai 4 textbox (text1: N°produit , text2=libellé , text3=Prix u : text4 =Quantité en stocl) et List1 qui Port tous N°Produit saisie
le probleme c'est ke quand j supprime un Enregistrement il dois etre supprimer Aussi dans List1 Sur le Champs
j'ai fé list1.removeitem (!Num_prod) Mais ca marche pa sous ce Programme ci desus mais ca marche pa il m indique type incomptabile pouvez vous m aider svp
ainsi je veux aussi quand je enregistre les donnée il dois m afficher sur le champs le N° Produit Sur le List1
Merci
j'utilise toolbar
select case buton.index
case is = 1 'Bouton Enregistrer
va = MsgBox("Voulez Vous Vraiment" & Chr(13) & "Enregistrer Les Données", vbYesNo + vbInformation, "Confirmation")
If va = 6 Then
SQL = " insert into Produit " & _
" values ('" & Text1 & "' , '" & Text2 & "' , " & Text3 & " , " & Text4 & ")"
Base.Execute SQL
'l ajout ds list box dois etre ici
endif
case is = 3 'Bouton Supprimer
sql = " update from Produit where Num_prod = '" & text1 & "'"
base.execute sql ' base c'est variable du base donnée
' la suppression ds listbox dois etre ici
c'est ke j'ai un form2 par Exemple j'ai 4 textbox (text1: N°produit , text2=libellé , text3=Prix u : text4 =Quantité en stocl) et List1 qui Port tous N°Produit saisie
le probleme c'est ke quand j supprime un Enregistrement il dois etre supprimer Aussi dans List1 Sur le Champs
j'ai fé list1.removeitem (!Num_prod) Mais ca marche pa sous ce Programme ci desus mais ca marche pa il m indique type incomptabile pouvez vous m aider svp
ainsi je veux aussi quand je enregistre les donnée il dois m afficher sur le champs le N° Produit Sur le List1
Merci
j'utilise toolbar
select case buton.index
case is = 1 'Bouton Enregistrer
va = MsgBox("Voulez Vous Vraiment" & Chr(13) & "Enregistrer Les Données", vbYesNo + vbInformation, "Confirmation")
If va = 6 Then
SQL = " insert into Produit " & _
" values ('" & Text1 & "' , '" & Text2 & "' , " & Text3 & " , " & Text4 & ")"
Base.Execute SQL
'l ajout ds list box dois etre ici
endif
case is = 3 'Bouton Supprimer
sql = " update from Produit where Num_prod = '" & text1 & "'"
base.execute sql ' base c'est variable du base donnée
' la suppression ds listbox dois etre ici
A voir également:
- I need a help
- I showkeyplus - Télécharger - Utilitaires
- I sans point ✓ - Forum Windows
- Bouton on off o i - Forum Word
- I love pdf avis ✓ - Forum PDF
- O ou i pour allumer - Forum Facebook
4 réponses
je remplis le listbox j le programme dans form load
Private Sub form_load()
with E_produit
if not .eof then .movefirst
while not .eof
list1.additem !Num_prod
if not .eof then .movenext
wend
end with
end sub
Private sub list1_click()
text1=list1
text1_lostfocus
end sub
Private Sub Text1_LostFocus()
If Text1 <> "" Then
With E_produit
.Index = "Produit_ndx"
.Seek "=", Text1
If Not .NoMatch Then
Text2 = !Lib_prod
Text3 = !Pu_prod
Text4 = !Qs_prod
Toolbar1.Buttons(1).Enabled = 0 'bouton Enregistrer
Toolbar1.Buttons(2).Enabled = 1 'bouton Modifier
Toolbar1.Buttons(3).Enabled = 1 'bouton Supprimer
Else
Text2.text = "": Text3.text = "": Text4.text = ""
End If
End With
End If
End Sub
Private Sub form_load()
with E_produit
if not .eof then .movefirst
while not .eof
list1.additem !Num_prod
if not .eof then .movenext
wend
end with
end sub
Private sub list1_click()
text1=list1
text1_lostfocus
end sub
Private Sub Text1_LostFocus()
If Text1 <> "" Then
With E_produit
.Index = "Produit_ndx"
.Seek "=", Text1
If Not .NoMatch Then
Text2 = !Lib_prod
Text3 = !Pu_prod
Text4 = !Qs_prod
Toolbar1.Buttons(1).Enabled = 0 'bouton Enregistrer
Toolbar1.Buttons(2).Enabled = 1 'bouton Modifier
Toolbar1.Buttons(3).Enabled = 1 'bouton Supprimer
Else
Text2.text = "": Text3.text = "": Text4.text = ""
End If
End With
End If
End Sub
ok
fais une procédure pour remplir la listbox:
Ensuite tu appelles la procédure dans le load de la form :
et tu fais appel à cette procédure (InitListBox) pour la mise à jour dans ton select case :
;o)
polux
fais une procédure pour remplir la listbox:
Private Sub InitListBox() with E_produit list1.clear if not .eof then .movefirst while not .eof list1.additem !Num_prod if not .eof then .movenext wend end with end sub
Ensuite tu appelles la procédure dans le load de la form :
Private Sub form_load() InitListBox end sub
et tu fais appel à cette procédure (InitListBox) pour la mise à jour dans ton select case :
select case buton.index case is = 1 'Bouton Enregistrer va = MsgBox("Voulez Vous Vraiment" & Chr(13) & "Enregistrer Les Données", vbYesNo + VBInformation, "Confirmation") If va = 6 Then SQL = " insert into Produit " & _ " values ('" & Text1 & "' , '" & Text2 & "' , " & Text3 & " , " & Text4 & ")" Base.Execute SQL InitListBox end if ....
;o)
polux
Merci sa marche bien Pr mise a jour pr la Supression et validation a propo d mise a jour lors d la validation on peu faire
Private sub toolbar_button()
select case button.index
Case Is = 1 'Bouton Enregistrer
va = MsgBox("Voulez Vous Vraiment" & Chr(13) & "Enregistrer Les Données", vbYesNo + vbInformation, "Confirmation")
If va = 6 Then
SQL = " insert into Produit " & _
" values ('" & Text1 & "' , '" & Text2 & "' , " & Text3 & " , " & Text4 & ")"
Base.Execute SQL
list1.additem text1 'mise a jour l ors d la validation
Mais on dois programmer textbox lost focus et list1 click
private sub list1_click()
text1=list1
text1_lostfocus
end sub
voila
Merci bcp
Private sub toolbar_button()
select case button.index
Case Is = 1 'Bouton Enregistrer
va = MsgBox("Voulez Vous Vraiment" & Chr(13) & "Enregistrer Les Données", vbYesNo + vbInformation, "Confirmation")
If va = 6 Then
SQL = " insert into Produit " & _
" values ('" & Text1 & "' , '" & Text2 & "' , " & Text3 & " , " & Text4 & ")"
Base.Execute SQL
list1.additem text1 'mise a jour l ors d la validation
Mais on dois programmer textbox lost focus et list1 click
private sub list1_click()
text1=list1
text1_lostfocus
end sub
voila
Merci bcp