Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I know that if we want to increase the index i into 1 every time in a for loop we write i++
But I want to increase i into 7 every time. I have given my code. Can anyone help me, please!!!

C#
if (ddlMaintenPlan.SelectedItem.Text == "Weekly")
           {
               
               DateTime dtLastday = Convert.ToDateTime(dtpMaintenceEnd.Text.Trim());
               while (dsStartDate <= dtLastday)
               {
                   
                   for (int i = Convert.ToInt32(dsStartDate); i < Convert.ToInt32(dtLastday); i++)
                   {
                       dsStartDate = Convert.ToDateTime(Convert.ToInt32(dsStartDate) + Convert.ToInt32(i.ToString()));
                       DRLocal = DTLocal.NewRow();
                       DTLocal.Rows.Add(dsStartDate);
                   }
               }



           }
Posted

1 solution

C#
for (int i = Convert.ToInt32(dsStartDate); i < Convert.ToInt32(dtLastday); i += 7)
 
Share this answer
 
Comments
Sumon562 2-Jun-13 3:16am    
wow!!! I am really happy. Thanks

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