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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Nov 1, 2011, 12:55 AM EDT
Pravin MoreRank #1,419 · 1.2K reputationPosted Oct 31, 2011, 11:15 PM EDT
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.
Pravin MoreRank #1,419 · 1.2K reputationPosted Oct 31, 2011, 11:20 PM EDT
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.
Hemant KumarRank #1,202 · 1.5K reputationPosted Nov 1, 2011, 12:19 AM EDT
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));