Saturday, 10 December 2011

Extract Last Characters From a String

Extract Last 3 Character From A TextBox And Show It On Label
Sometimes You Come To A Situation Where You Have Alot But You Need Only A Tiny Part Of It,Thats Where The Extract Concept  Come!
In C# Many Time You Will Get Strinig With Some Length But You Need In Your Own Size,So Just Follow The 2 Points Below....
1)
You can use this code in any click event...


int Len=TextBox1.Text.Length;
string Sub=TextBox1.Text.SubString(Len-3,3);
Lable.Text=Sub;


2)
and look yourself what will be result.

No comments:

Post a Comment

Print Only Grid View in ASP.net

ASP.net How to Print Only GridView < div id ="gridviewDiv" >   < asp:GridView ID ="gridViewToPri...