Click here to Skip to main content
12,251,889 members (59,989 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
I don't don't really know how, this is my half attempt on it, its oboiusly doesn't work

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
hi2
hi3
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

if(stringcollection.contains(h3)
{
}

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

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 6-Jan-13 19:38pm
Edited 6-Jan-13 19:51pm
v2
Comments
Suvabrata Roy 7-Jan-13 1:50am
   
I did not understand what is your problem ...
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hi Tech,
i just made a sample for your help....may be it can help u

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");
       }
  Permalink  
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100