Why would you need to use replace?
Why not just build the text into the string in the first place.
This is a VERY basic version of what Alice was talking about:
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents tbxName As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents tbxHome As System.Windows.Forms.TextBox
Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox
Friend WithEvents btnShow As System.Windows.Forms.Button
Friend WithEvents btnOK As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.tbxName = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.tbxHome = New System.Windows.Forms.TextBox()
Me.RichTextBox1 = New System.Windows.Forms.RichTextBox()
Me.btnShow = New System.Windows.Forms.Button()
Me.btnOK = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'tbxName
'
Me.tbxName.Location = New System.Drawing.Point(88, 24)
Me.tbxName.Name = "tbxName"
Me.tbxName.TabIndex = 0
Me.tbxName.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 23)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Name"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.BottomLeft
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(16, 56)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(64, 23)
Me.Label2.TabIndex = 3
Me.Label2.Text = "HomeTown"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.BottomLeft
'
'tbxHome
'
Me.tbxHome.Location = New System.Drawing.Point(88, 56)
Me.tbxHome.Name = "tbxHome"
Me.tbxHome.TabIndex = 2
Me.tbxHome.Text = ""
'
'RichTextBox1
'
Me.RichTextBox1.Location = New System.Drawing.Point(200, 24)
Me.RichTextBox1.Name = "RichTextBox1"
Me.RichTextBox1.Size = New System.Drawing.Size(208, 96)
Me.RichTextBox1.TabIndex = 4
Me.RichTextBox1.Text = ""
'
'btnShow
'
Me.btnShow.Location = New System.Drawing.Point(88, 96)
Me.btnShow.Name = "btnShow"
Me.btnShow.TabIndex = 5
Me.btnShow.Text = "Show"
'
'btnOK
'
Me.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK
Me.btnOK.Location = New System.Drawing.Point(168, 160)
Me.btnOK.Name = "btnOK"
Me.btnOK.TabIndex = 6
Me.btnOK.Text = "Ok"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(424, 221)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnOK,
Me.btnShow, Me.RichTextBox1, Me.Label2, Me.tbxHome, Me.Label1, Me.tbxName})
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnShow.Click
Me.RichTextBox1.Text = "My name is " & Me.tbxName.Text &
Microsoft.VisualBasic.ChrW(10) & "I was born in " & Me.tbxHome.Text
End Sub
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOK.Click
Dispose()
End Sub
End Class