Wie ersetzen eines Teilstrings in VB.NET?

Ich habe eine Frage mit dem string Replace - Funktion in Visual Basic .NET:

Ich habe ein Visual Basic-Skript für mein Projekt. Ich habe eine RichTextBox namens sample

Dim string1 as string = "text to find"
Dim string2 as string = "text to replace find with"
Dim mediacurrent as string

mediacurrent = sample.text

mediacurrent.replace(string1, string2)

sample.text = mediacurrent

Das obige Skript gibt ein leeres Textfeld. Hinweis: das Textfeld ist Reich und enthält nicht formatiert, aber mit mehrzeiligem text. Was mache ich falsch?

InformationsquelleAutor Wihf134 | 2011-09-03
Schreibe einen Kommentar