Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.50/5 (8 votes)
Please suggest me..
How to count same index in ( For Loop )
Posted
Comments
Sk. Tajbir 9-May-12 5:51am    
can you explain in more details ?
Sandeep Mewara 9-May-12 12:32pm    
Not clear. We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.
[no name] 11-May-12 4:19am    
Explain You question Little bit more.
t-g-f 13-May-12 9:40am    
what do you mean by same index ?

Why don' use this


for(int i=0;i<items.count;i++)
{
// You can use i like counter you don't need anything else
}
 
Share this answer
 
v2
Comments
JoCodes 9-Feb-14 4:41am    
Posted for almost 2 years old question. :)
So_IAS 9-Feb-14 9:17am    
Maybe someone else will need this in the future.
CHill60 9-Feb-14 14:03pm    
Then they would probably have looked at Solution 1!
Member 10582251 12-Feb-14 14:06pm    
Yes, and almost 2 years standing solution with counter inside for loop. Interesting.
King Fisher 20-Feb-14 1:52am    
:)
C#
int count=0;
for(int i=0;i<=items.count;i++)
{
count=count+1;
}
 
Share this answer
 
v2
C#
for(initialization; condition; step)
  statement


VB
initialization    : Initialize the value of variable.
condition     : Evaluate the condition
step          : Step taken for each execution of loop body


Example...... Asp.Net For Loop

Patter
 
Share this answer
 
what eror on below code



C#
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        for(int I=0;I<(CheckBoxList1.Items.Count;I++)
         IF(CheckBoxList1.Items[I].Selected==true)
            {
                Response.Write(CheckBoxList1.Items[I]=tostring());
 
Share this answer
 

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