Click here to Skip to main content
Rate this: bad
good
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
Adi_1.8K
v2
Comments
Suvabrata Roy at 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
Your Filters
Interested
Ignored
     
0 Shai Vashdi 600
1 Tadit Dash 295
2 Sergey Alexandrovich Kryukov 250
3 Peter Leow 190
4 OriginalGriff 158
0 Sergey Alexandrovich Kryukov 9,395
1 OriginalGriff 5,473
2 Peter Leow 4,150
3 Maciej Los 3,540
4 Abhinav S 3,333


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid