That's the fault of your VB code: why are you doing this at all:
Val(str.Length + 1)
Val converts a string to a number, so you take two numbers, add them together, convert them to a string, then convert them back to a number...
Try:
string str = textBox1.Text.Replace(" ", null);
textBox1.Text = textBox2.Text.Substring(textBox2.Text.IndexOf(str) + str.Length + 1).Split(" ")[0];