C# chapter 4 :
For any one that have not read chapter 1 , 2 & 3 ,
Please refer C# chapter 1 , 2 & 3 if have any question.
OK! Let continue !
Deleting part of the line
Line count start from 0, so if Line is: ABCD
A=0 , B=1 , C=2 , D=3
C# code:
private void button1_Click(object sender, EventArgs e)
{
string STR_A;
string STR_D;
STR_A = "abcdefgh";
textBox1.Text = STR_A;
STR_D = STR_A.Remove(0, 2);
textBox1.Text = textBox1.Text + "\r\n" + STR_D;
}
THEN Select Debug -> Start without Debugging
~ ~ Wait for a while ~ ~ ~
The program Form screen will come out.
Let click on button1
abcdefgh
cdefgh
will show up inside the Textbox.
Remove(A, B)
A = start from ?
B = How many character to be delete
for the program above Remove(0, 2) is start from the 1st position in line , delete 2 character
abcdefgh
" a " is the one at the 1st position in line ,
delete 2 character , so " a " & " b " had been deleted.
abcdefgh become cdefgh
Example 2:
private void button1_Click(object sender, EventArgs e)
{
string STR_A;
string STR_D;
STR_A = "abcdefgh";
textBox1.Text = STR_A;
STR_D = STR_A.Remove(5, 1);
textBox1.Text = textBox1.Text + "\r\n" + STR_D;
}
THEN Select Debug -> Start without Debugging
~ ~ Wait for a while ~ ~ ~
The program Form screen will come out.
Let click on button1
abcdefgh
abcdegh
will show up inside the Textbox.
Remove(A, B)
A = start from ?
B = How many character to be delete
for the program above Remove(5, 1) is start from the 6th position in line , delete 1 character
abcdefgh
" f " is the one at the 6th position in line ,
delete 1 character , so only " f " that had been deleted.
abcdefgh become abcdegh
Must Remember This
Line count start from 0, so if Line is: ABCD
A=0 , B=1 , C=2 , D=3
___________________________________________
Need More Detail ? contact me !!
Please send me some money at Paypal
Any small amount is welcome , even 10 cents is good for me.
I will guide you step by step, personally.
My Paypal Account is : ksw.industries@gmail.com
Don't know how to send money ? Click here for detail about Paypal account.
http://xyberpast.blogspot.com/2014/05/how-to-get-my-program.html
Don't have money? OK! Here is another way to get the program.
how to get my program - Free of charge
For any one that have not read chapter 1 , 2 & 3 ,
Please refer C# chapter 1 , 2 & 3 if have any question.
OK! Let continue !
Working with Text
Deleting part of the line
Line count start from 0, so if Line is: ABCD
A=0 , B=1 , C=2 , D=3
C# code:
private void button1_Click(object sender, EventArgs e)
{
string STR_A;
string STR_D;
STR_A = "abcdefgh";
textBox1.Text = STR_A;
STR_D = STR_A.Remove(0, 2);
textBox1.Text = textBox1.Text + "\r\n" + STR_D;
}
THEN Select Debug -> Start without Debugging
~ ~ Wait for a while ~ ~ ~
The program Form screen will come out.
Let click on button1
abcdefgh
cdefgh
will show up inside the Textbox.
Remove(A, B)
A = start from ?
B = How many character to be delete
for the program above Remove(0, 2) is start from the 1st position in line , delete 2 character
abcdefgh
" a " is the one at the 1st position in line ,
delete 2 character , so " a " & " b " had been deleted.
abcdefgh become cdefgh
Example 2:
private void button1_Click(object sender, EventArgs e)
{
string STR_A;
string STR_D;
STR_A = "abcdefgh";
textBox1.Text = STR_A;
STR_D = STR_A.Remove(5, 1);
textBox1.Text = textBox1.Text + "\r\n" + STR_D;
}
THEN Select Debug -> Start without Debugging
~ ~ Wait for a while ~ ~ ~
The program Form screen will come out.
Let click on button1
abcdefgh
abcdegh
will show up inside the Textbox.
Remove(A, B)
A = start from ?
B = How many character to be delete
for the program above Remove(5, 1) is start from the 6th position in line , delete 1 character
abcdefgh
" f " is the one at the 6th position in line ,
delete 1 character , so only " f " that had been deleted.
abcdefgh become abcdegh
Must Remember This
Line count start from 0, so if Line is: ABCD
A=0 , B=1 , C=2 , D=3
Line count start from 0
___________________________________________
Need More Detail ? contact me !!
Please send me some money at Paypal
Any small amount is welcome , even 10 cents is good for me.
I will guide you step by step, personally.
My Paypal Account is : ksw.industries@gmail.com
Don't know how to send money ? Click here for detail about Paypal account.
http://xyberpast.blogspot.com/2014/05/how-to-get-my-program.html
Don't have money? OK! Here is another way to get the program.
how to get my program - Free of charge
No comments:
Post a Comment