Sunday, May 8, 2011

Replace specific text in TextBox

If you have to textboxes, and TextBox1 is filled with the sentence "I am the smartest man in the world" and you want the word "smartest" to change with the word written  in textbox2 you have to write the code bellow:

        If TextBox1.Text.Contains("smartest") Then
            TextBox1.Text = TextBox1.Text.Replace("smartest", TextBox2.Text)
        End If

No comments:

Post a Comment