Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
VB
X=0
For i = 0 To TextBoxLength – 1
X=x+1
If ( TextBox1.Text(i) =" " ) then 

TextBox1 = TextBox1.Replace(" ", (20-x))      

Next i

this code find in internet to replace 20 space between term to length term but is not run why and how to solve in vb.net 2010
Posted
Updated 4-Apr-12 5:55am
v2
Comments
Kschuler 4-Apr-12 11:53am    
You've posted this same question quite a few times now. Please do not continue to post the same question over and over. Instead, click the Improve question link and add any new information to your original question.
Kschuler 4-Apr-12 11:56am    
What do you mean by "term"?
Eugene Sadovoi 4-Apr-12 12:06pm    
Am I correct that you want to remove all the spaces from your target string? So the string "some text here" will became "sometexthere".

1 solution

If all you want to do is to replace/remove spaces from your string I would suggest using Regex class. You would call it like this:

VB
String resultStr = Regex.Replace(sourceStr, " ", "")
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900