Hi friends,
I want to display a string of this format in the text box at page load
/current financial year(11-12)/00001 i mean
/11-12/00001 like this.How do i get it?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Nov 1, 2011, 4:55 AM
Hemant KumarPosted Nov 1, 2011, 4:19 AM
String temp = "/current financial year(11-12)/00001";
int indexOfStartBrace = temp.IndexOf('(');
int indexOfEndBrace = temp.LastIndexOf(')');
string btwBraces = temp.Substring(indexOfStartBrace);
string temp1 = btwBraces.Replace("(", "/");
MessageBox.Show(temp1.Replace(")", String.Empty));
Pravin MorePosted Nov 1, 2011, 3:20 AM
string dt=DateTime.Now.Year.ToString();
dt = dt.Remove(0, 2);
string dt1=DateTime.Now.AddYears(1).Year.ToString();
dt1 = dt1.Remove(0, 2);
textBox1.Text="/"+dt+"-"+dt1+"/00001";
output is like /11-12/00001
Thanx,
Pravin.
Pravin MorePosted Nov 1, 2011, 3:15 AM
you can do it...here is code......
string dt=DateTime.Now.Year.ToString();
string dt1=DateTime.Now.AddYears(1).Year.ToString();
// MessageBox.Show(dt +"-"+dt1);
textBox1.Text="/"+dt+"-"+dt1+"/00001";
this will solve your problem.
Thanx,
Pravin.