Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I don't don't really know how, this is my half attempt on it, its oboiusly doesn't work

C#
int addnumber = 0;
       while (addnumber < Properties.Settings.Default.DatesEventNames.Count)
       {
           addnumber = addnumber + 1;
               DateTime yourDateTime = DateTime.ParseExact(item, "ddMMyyyy", CultureInfo.InvariantCulture);
       }


Lets say I have a string collection with this in it

hi<br />
hi2<br />
hi3<br />
hi4


and i just want to see h3 in my textbox, and not really all of them, I want to be able to read the line by the line number not

CSS
if(stringcollection.contains(h3)
{
}


so I dont want the contains string method, I want the method that it kinda like

C#
In (stringcollection.linenumber == 3)
{
textbox.text = the string's text on that line number
}



and that would be "hi3". can anyone please help me out with this?
Posted
Updated 6-Jan-13 19:51pm
v2
Comments
Suvabrata Roy 7-Jan-13 1:50am    
I did not understand what is your problem ...

You have a collection, you can access it by index. myStringCollection[3]. Also, you can use a dictionary if you want to use a non sequential index to access an item
 
Share this answer
 
Hi Tech,
i just made a sample for your help....may be it can help u

C#
ArrayList list = new ArrayList();
       list.Add("hi1");
       list.Add("hi2");
       list.Add("hi3");
       foreach (string item in list)
       {

           int index=item.LastIndexOf('3');
           if (index==2)//**also u can use (index>1)
               Response.Write("hi3");
       }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900