bonjour
je bosse sur visual basic 6,donc avec des form.
Le probléme c que je sais pas comment récupérer les phrases ki sont dans les msgbox (qui fonctionnent!!) et le faire apparaitre dans les zones de texte du Form!validation (qui sont a la base vides).au début je pensais récupérer les valeurs qui s'inscrivaient dans les tableaux
crées dans le module mais apparemment ça ne reste pas fixe dans le tableau et donc je ne peux pas récupérer quand j'appelle les données des tableaux a partir du Form_validation.je remercie ceux qui essairons de m'aider.
voici le code des trois feuilles:
*voici le code de la premiére feuille:Form_inscriptions
Private Sub btn_Commander_inscription_Click()
Dim boîte_dialogue As String
If saisie_inscriptions(0).Text <> "" Then
If saisie_inscriptions(1).Text <> "" Then
If saisie_inscriptions(2).Text <> "" Then
Dim affectation As structure_tab_client
affectation.Nom = saisie_inscriptions(0).Text
affectation.Prénom = saisie_inscriptions(1).Text
affectation.Age = saisie_inscriptions(2).Text
boîte_dialogue = message_client(affectation)
MsgBox boîte_dialogue
Form_article.Show ' ouvrir ARTICLES
Form_inscriptions.Hide 'FERMER INSCRIPTIONS
End If
End If
Else
MsgBox "Tous les champs doivent être remplis!!!!"
End If
End Sub
voila le code de la deuxième feuille:Form_article
Private Sub btn_ok_article_Click()
Dim affectation_veste As structure_tab_veste
Dim transfert As String
Dim affectation_jupe As structure_tab_jupe
Dim result_article As String
Dim prix_total_jupe As Integer
Dim prix_final As Integer
Dim facture_totale As Integer
If radio1_article.Value = True Then
affectation_veste.nom_veste = "Veste1"
affectation_veste.prix_unitaire_veste = 40
affectation_veste.quantite_veste = quantite_veste.Text
prix_final = (quantite_veste.Text) * 40
affectation_veste.prix_veste_final = prix_final
'initialisation("Veste1",40,quantite_veste.Text,prix_final)
transfert = valeurs_ds_veste(affectation_veste)
MsgBox transfert
End If
If radio2_article.Value = True Then
affectation_veste.nom_veste = "Veste2"
affectation_veste.prix_unitaire_veste = 50
affectation_veste.quantite_veste = quantite_veste.Text
prix_final = (quantite_veste.Text) * 50
affectation_veste.prix_veste_final = prix_final
transfert = valeurs_ds_veste(affectation_veste)
MsgBox transfert
End If
If radio3_article.Value = True Then
affectation_veste.nom_veste = "Veste3"
affectation_veste.prix_unitaire_veste = 60
affectation_veste.quantite_veste = quantite_veste.Text
prix_final = (quantite_veste.Text) * 60
affectation_veste.prix_veste_final = prix_final
transfert = valeurs_ds_veste(affectation_veste)
MsgBox transfert
End If
'If choix_jupe(0).Value = Checked Then
' affectation_jupe.nom_jupe = "jupe1"
' affectation_jupe.prix_unitaire_jupe = 30
' affectation_jupe.quantite_jupe = quantite_jupe(0).Text
' affectation_jupe.prix_jupe_final = quantite_jupe(0).Text * 30
' result_article = message_article(affectation_jupe)
' MsgBox result_article
'End If
'If choix_jupe(1).Value = Checked Then
' affectation_jupe.nom_jupe = "jupe2"
' affectation_jupe.prix_unitaire_jupe = 40
' affectation_jupe.quantite_jupe = quantite_jupe(1).Text
' affectation_jupe.prix_jupe_final = quantite_jupe(1).Text * 40
' message_article (affectation_jupe)
' MsgBox result_article
'End If
'If choix_jupe(2).Value = Checked Then
' affectation_jupe.nom_jupe = "jupe3"
' affectation_jupe.prix_unitaire_jupe = 50
' affectation_jupe.quantite_jupe = quantite_jupe(2).Text
' affectation_jupe.prix_jupe_final = quantite_jupe(2).Text * 50
' message_article (affectation_jupe)
'MsgBox result_article
'End If
prix_total_jupe = 0
For I = 0 To 2
If choix_jupe(I).Value = Checked Then
affectation_jupe.nom_jupe = "jupe" & (I + 1)
affectation_jupe.prix_unitaire_jupe = (30 + (10 * I))
affectation_jupe.quantite_jupe = quantite_jupe(I).Text
affectation_jupe.prix_jupe_final = (quantite_jupe(I).Text * (30 + (10 * I)))
prix_total_jupe = prix_total_jupe + (quantite_jupe(I).Text * (30 + (10 * I)))
result_article = message_article(affectation_jupe)
MsgBox result_article
End If
Next
facture_totale = somme(prix_final, prix_total_jupe)
MsgBox "La facture finale est:" & facture_totale & "Euros"
Form_validation.Show
Form_article.Hide
End Sub
code de la troisiéme feuille: Form_validation
Private Sub btn_ok_validation_Click()
If nom_validation.Text <> "" Then
MsgBox "votre commande est prise en compte.Merci"
Form_validation.Hide
End If
End Sub
'Private Sub nom_validation_Change()
'Dim N As Integer
'For N = 1 To NB_CLIENT Step 1
' client (N)
' nom_validation.Text = " " & client(N).Nom
'Next
'End Sub
'Private Sub prenom_validation_Change()
'Dim N As Integer
' For N = 1 To NB_CLIENT Step 1
'client (N)
'prenom_validation.Text = " " & client(N).Prénom
'Next
'End Sub
Private Sub resultat_validation_veste_Change()
'Dim affect As structure_tab_veste
'Dim detail As String
Dim detail_veste As String
' affect.nom_veste = veste(0).nom_veste
' affect.prix_unitaire_veste = veste(0).prix_unitaire_veste
' affect.quantite_veste = veste(0).quantite_veste
' affect.prix_veste_final = veste(0).prix_veste_final
' detail = valeurs_ds_veste(affect)
' resultat_validation_veste.Text = detail
'COMMENT FAIRE POUR RECUPERER LA PHRASE DE LA FONCTION afficher_validation1 du module????
detail_veste = afficher_validation1()
resultat_validation_veste.Text = "detail_veste"
'''resultat_validation_veste.Text = "anna"
End Sub
et le MODULE:
Public Const NB_CLIENT As Integer = 200
Type structure_tab_client 'pr faciliter les tableaux
Nom As String * 20 'montre le nbre de caractères maximal
Prénom As String * 20
Age As Integer
End Type
Type structure_tab_veste
nom_veste As String
prix_unitaire_veste As Integer
quantite_veste As Integer
prix_veste_final As Integer
End Type
Type structure_tab_jupe
nom_jupe As String
prix_unitaire_jupe As Integer
quantite_jupe As Integer
prix_jupe_final As Integer
End Type
Public client(1 To NB_CLIENT) As structure_tab_client ' déclaration du tableau client
Public veste(0) As structure_tab_veste ' déclaration du tableau veste
Public jupe(3) As structure_tab_jupe 'déclaration du tableau jupe
Public Function message_client(saisie As structure_tab_client) As String
Dim I As Integer
For I = 1 To NB_CLIENT Step 1
client(I).Nom = saisie.Nom
client(I).Prénom = saisie.Prénom
client(I).Age = saisie.Age
message_client = "bienvenue à:" & client(I).Nom & client(I).Prénom & "!!!!"
Next
End Function
Public Function valeurs_ds_veste(saisie_veste As structure_tab_veste) As String
veste(0).nom_veste = saisie_veste.nom_veste
veste(0).prix_unitaire_veste = saisie_veste.prix_unitaire_veste
veste(0).quantite_veste = saisie_veste.quantite_veste
veste(0).prix_veste_final = saisie_veste.prix_veste_final
valeurs_ds_veste = "cas des vestes:" & veste(0).quantite_veste & " veste(s),de nom " & veste(0).nom_veste & " Le prix final est:" & veste(0).prix_veste_final & "Euros"
afficher_validation1 (valeurs_ds_veste)
End Function
Public Function message_article(choix_jupe As structure_tab_jupe) As String
Dim I As Integer
For I = 0 To 2
jupe(I).nom_jupe = choix_jupe.nom_jupe
jupe(I).prix_unitaire_jupe = choix_jupe.prix_unitaire_jupe
jupe(I).quantite_jupe = choix_jupe.quantite_jupe
jupe(I).prix_jupe_final = choix_jupe.prix_jupe_final
message_article = "cas des jupes:" & jupe(I).quantite_jupe & " jupe(s),de nom " & jupe(I).nom_jupe & " Le prix final est:" & jupe(0).prix_jupe_final & "Euros"
Next
End Function
Public Function somme(valeur1 As Integer, valeur2 As Integer)
somme = valeur1 + valeur2
End Function
'Public Sub initialisation(ByVal nom_vte As String, ByVal prix_unitaire_vte As Integer, ByVal Quantite_vte As Integer, ByVal prix_vte_final As Integer)
' veste(0).nom_veste = nom_vte
' veste(0).prix_unitaire_veste = prix_unitaire_vte
' veste(0).quantite_veste = Quantite_vte
' veste(0).prix_veste_final = Quantite_vte
'End Sub
'RECUPERE LA PHRASE PR VESTE ET LA RENVOIE
Public Function afficher_validation1(msg As String) As String
afficher_validation1 = msg
End Function