Following is your code , I am Modified only ....
D
im X As Integer = 0
Dim i As Integer
Dim TextBoxLength As Integer = 0
TextBoxLength = TextBox1.Text.Length
For i = 0 To TextBoxLength - 1
X = X + 1
If TextBox1.Text.Substring(i) = " " Then
TextBox1.Text = TextBox1.Text.Replace(" ", (20 - X))
End If
Next i
Please explain following things
1. TextBox1.Text.Replace(" ", (20 - X))? and 20 - x ?
2. What do you want to do exactly ?