hi
i have to get the text entered in the textbox using substring function
Example:
the text Karthik-PVC is entered in the textbox
My code:
EmpName = txtProjEmployeeCode.Text.Substring(0, txtProjEmployeeCode.Text.LastIndexOf('-'));
output:karthik
i have to get only text after the '-'
how to write code for that using substring dynamically what ever the text i there after '-'i have to retreive
plz help me
thanks
karthik
Loading
VulpesPosted Dec 7, 2011, 5:07 AM
You could also replace the last line with:
EmpName = text.Split('-')[1];
Pravin MorePosted Dec 7, 2011, 4:26 AM
string str1=txtProjEmployeeCode.Text;
EmpName = txtProjEmployeeCode.Text.Substring(txtProjEmployeeCode.Text.LastIndexOf('-')+1,str1.Length);
Thanks,
Pravin.