Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i'm some kind new in programming, so Can any one help me on how we can remove a specific text length from a richtextbox, just like the example below,
HTML
SUV          4402577816         ABC        00:00:00 109.127.100.33
SUV          6651215553         ABC        00:00:00 109.127.104.75
SUV          6651231564         ABC        00:00:00 93.91.192.232


and i need it to be like this:
HTML
109.127.100.33
109.127.104.75
93.91.192.232



any advice will be helpful,
thanks again
Posted
Updated 25-Aug-12 7:57am
v3
Comments
Kenneth Haugland 25-Aug-12 13:58pm    
Use String.Split(" ")
Sarrrva 25-Aug-12 14:17pm    
this function Syntax:
String.Split(params char[]);

regards
sarva

hi friend,

C#
private void button1_Click(object sender, EventArgs e)
        {
            string[] x = { "SUV 4402577816 ABC 00:00:00 109.127.100.33", "SUV 6651215553 ABC 00:00:00 109.127.104.75", "SUV 6651231564 ABC 00:00:00 93.91.192.232" };
            for (int i = 0; i<x.Length; i++)
            {
                string[] d = x[i].Split(' ');
                MessageBox.Show(d[4].ToString());
            }
        }


regards
sarva
 
Share this answer
 
Hi,

You need to go though couple of articles of MSDN. You need knowledge of handling files and string functions like split.

MSDN: Information on Reading Text File[^]

MSDN : String.split method example[^]

Read all related links from MSDN and try something yourself. I know you can do this.

Best of luck
Thanks
-Amit Gajjar
 
Share this answer
 
Comments
Ahmed k dema 26-Aug-12 13:31pm    
thank you very much i found the solution from your recommended links,
thank you all for you answers.

Kind Regards,
AmitGajjar 27-Aug-12 0:03am    
Your welcome
It will come a string, you need to split on environment.newline. Then you can use the substring method of each string to trim it. And then you can clear the box and iterate over the strings, adding them to the box, with Environment.NewLine between them again.

This is too complex for someone who is 'new to programming', you should be in class, learning more basic things.
 
Share this answer
 

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