Posts

Showing posts from February, 2012

selecting perticular strings from inside a string

Hi, here my planning is to i have string with several values like string abcd={a=1,b=2,c=3,......z=26}. this is i have to select particular values like {j=10,l=12,q=17}. so here is my code that will retrive data like above scenerio. try             {                 String sOrrData = e.Result.ToString();//assigning abcd string to this string.                 string sOrr = "";                 String[] sOrrValues ={"j","l","q" };                 for (int i = 0; i < sOrrValues.Length; i++)                 {                     string sOrval = sOrrData.Substring(sOrrData.IndexOf(sOrrValues[i]), 100).ToString().Replace("\r\n", "$");                                        string[] sOrrSplit = sOrval.Split('$');                     sOrr += sOrrSplit[0].ToString().ToUpper() + "\r\n";                 }                 tborrdata.Text = sOrr;                 BusyIndicator4.IsBusy = false;    

argumentoutofrangeexception was unhandled by user code asp net

Actually my code is this ,am  getting this error for substring . here am writing my code this error. try             {                 if (tbMeterID.Text == "")                     return;                 if (tbMeterID.Text.Substring(4, 1) == "E")                 {                    //do some thing                   } }  am change the code as below. am solved this prob like this way. if (tbMeterID.Text != "")             {                 bool meter = tbMeterID.Text.Substring(4, 1).Equals("E");                 this.radBusyIndicator.IsBusy = false;                 if (e.Result.routeID == null)                     return;                                 if (meter == true)                 {                    //do something                 } }