Resultat=ChaineDépart.Replace(ChaîneARemplacer,ChaîneQuiRemplace)

cs_danu Messages postés 11 Date d'inscription mardi 15 mars 2005 Statut Membre Dernière intervention 30 avril 2010 - 25 mars 2009 à 21:06
cs_danu Messages postés 11 Date d'inscription mardi 15 mars 2005 Statut Membre Dernière intervention 30 avril 2010 - 27 mars 2009 à 17:35
Boisoir à tous,
j'ai tout juste commence avec vb 2005/2008 exp. après quelques annees en vb6

j'essaie de remplacer ProcessDetailLDialog  par Protokoll mais cela ne fonctionne pas.

mon txtbox est charge par listbox
     
 ************ Command4_Click
       Dim i As Integer
        For i = 0 To ListBox1.Items.Count - 1
            ListBox1.Items(i) = ListBox1.Items(i).ToUpper
            Textaltchem.Text = ListBox1.Items(i)
           Call cmdProtokoll()
      Next i

   ***********Private Sub cmdProtokoll()
        Dim be As String
        be = Textaltchem.Text      sous cette forme dans le textbox   (ProcessDetailLDialog_PDF_020216_113702.pdf)
        Dim s As String = be
        s = s.Replace("ProcessDetailLDialog", "Protokoll")

    
si je fais en chargeant manuelment mon txtbox, ca marche
       '******************* Button2_Click
       Dim be As String
        be = Textaltchem.Text     (je fais un copie[ProcessDetailLDialog_PDF_020216_113702.pdf] /colle dans le txtbox )
        Dim s As String = be
        MsgBox(s)
        s = s.Replace("ProcessDetailLDialog", "Protokoll")
        MsgBox(s)
  

 Merci à l'avance 
Dan'

2 réponses

cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 40
26 mars 2009 à 23:15
Il  n'y a, à priori pas de raison que ça ne marche pas. s-tu sur que ton problème ne vient pas d'ailleurs.

Au passage
Dim be As String

be = Textaltchem.Text

Dim s As String = be

s = s.Replace("ProcessDetailLDialog", "Protokoll")

peut s'écrire plus simplement
s = Textaltchem.Text.Replace("ProcessDetailLDialog", "Protokoll")

---- Sevyc64  (alias Casy) ----<hr size="2" width="100%" /># LE PARTAGE EST NOTRE FORCE #    http://aide-office-vba.monforum.com/index.php
0
cs_danu Messages postés 11 Date d'inscription mardi 15 mars 2005 Statut Membre Dernière intervention 30 avril 2010
27 mars 2009 à 17:35
Salut casy,

j'ai trouvé mon erreur en lisant ton aide:

ListBox1.Items(i) = ListBox1.Items(i) ----> [  .ToUpper ] mon erreur été ici avec les majuscules

j'ai essayé cala aussi, ca fonctionne
       
         Dim monTexte As String = Textaltchem.Text
         Dim maRegEx As New Regex("FinalReport", RegexOptions.IgnoreCase)
         monTexte = maRegEx2.Replace(monTexte, "Abschlussbericht")

Merci beaucoup
Danu
0
Rejoignez-nous