Copier plusieurs textbox dans une seule

MichelRRG74 -  
 MichelRRG74 -

Bonjour, 

Je souhaiterais copier les données de plusieurs textbox dans une seule textebox afin d'obtenir un résumé complet de ma saisie.
Pour cela j'ai trouvé le code suivant mais j'aimerais si une textbox est vide qu'elle ne soit pas inscrite dans le résumé.

Tbresumé.Text = _
    "Bonjour, " & vbCrLf & vbCrLf _
    & "Ci-dessous voici un lead pré-qualifié : " & vbCrLf & vbCrLf _
    & "Contact : " & TBcontact.Text & " (CDP : " & TBnuméroclientcdp.Text & ")" & vbCrLf _
    & "Entité : " & TBentité.Text & vbCrLf _
    & "Téléphone : " & TBtéléphone.Text & vbCrLf _
    & "E-Mail : " & TBmail.Text & vbCrLf _
    & "Site : " & CBsite.Text & vbCrLf & vbCrLf _
    & "Sa demande : " & TBdemande.Text & vbCrLf _
    & "Modèle : " & TBmodèle.Text & vbCrLf _
    & "Couleur : " & TBcouleur.Text & vbCrLf & "Options : " & TBoptions.Text & vbCrLf _
    & "Reprise : " & TBreprise.Text & vbCrLf _
    & "Fiche de reprise : " & TBfiche.Text & vbCrLf _
    & "Financement : " & TBfinancement.Text & vbCrLf & vbCrLf _
    & "Date du Projet : " & TBdateduprojet.Text & vbCrLf _
    & "Disponibilité : " & TBdisponibilité.Text & vbCrLf


Je vous remercie par avance

A voir également:

2 réponses

danielc0 Messages postés 1856 Date d'inscription   Statut Membre Dernière intervention   229
 

Bonjour,

Essaie :

  Dim Txt As String
  Txt = "Bonjour, " & vbCrLf & vbCrLf _
    & "Ci-dessous voici un lead pré-qualifié : " & vbCrLf & vbCrLf
  If TBcontact.Text <> "" Then
    Txt = Txt & "Contact : " & TBcontact.Text & " (CDP : " & TBnuméroclientcdp.Text & ")" & vbCrLf
  End If
  If TBentité.Text <> "" Then
    Txt = Txt & "Entité : " & TBentité.Text & vbCrLf
  End If
  If TBtéléphone.Text <> "" Then
    Txt = Txt & "Téléphone : " & TBtéléphone.Text & vbCrLf
  End If
  If TBmail.Text <> "" Then
    Txt = Txt = "E-Mail : " & TBmail.Text & vbCrLf
  End If
  If CBsite.Text <> "" Then
    Txt = txtt & "Site : " & CBsite.Text & vbCrLf & vbCrLf
  End If
  If TBdemande.Text <> "" Then
    Txt = Txt & "Sa demande : " & TBdemande.Text & vbCrLf
  End If
  If TBmodèle.Text <> "" Then
    Txt = Txt & "Modèle : " & TBmodèle.Text & vbCrLf
  End If
  If TBcouleur.Text <> "" Then
    Txt = Txt & "Couleur : " & TBcouleur.Text & vbCrLf & "Options : " & TBoptions.Text & vbCrLf
  End If
  If TBreprise.Text <> "" Then
    Txt = Txt & "Reprise : " & TBreprise.Text & vbCrLf
  End If
  If TBfiche.Text <> "" Then
    Txt = Txt & "Fiche de reprise : " & TBfiche.Text & vbCrLf
  End If
  If TBfinancement.Text <> "" Then
    Txt = Txt & "Financement : " & TBfinancement.Text & vbCrLf & vbCrLf
  End If
  If TBdateduprojet.Text <> "" Then
    Txt = Txt & "Date du Projet : " & TBdateduprojet.Text & vbCrLf
  End If
  If TBdisponibilité.Text <> "" Then
    Txt = Txt & "Disponibilité : " & TBdisponibilité.Text & vbCrLf
  End If
  Tbresumé.Text = Txt

Daniel


0
MichelRRG74
 

Merci DanielC0 Après quelques modifications de ton code j'ai pu trouver ce dont j'avait besoin tu m'enlevé un épine du pied ????

0
f894009 Messages postés 17277 Date d'inscription   Statut Membre Dernière intervention   1 713
 

Bonjour,

Vous creez une variable par Textebox  ou goupes d'object que vous remplissez si le ou groupe object est non vide.

A la fin vous creez le contenu de la textebox resume avec toutes les variables en mettant les crlf entre chaque 

0
MichelRRG74
 

Merci pour ton retour f894009. Je n'ai pas essayé ta solution mais en effet elle semble très logique. Merci pour ta réactivité ????

0