this is my code
int i = 0;
foreach (string item in Properties.Settings.Default.DatesEventNames)
{
if ((i++ % 3) == 0)
{
Label neweventlabel = new Label();
neweventlabel.Content = item;
SP1.Children.Add(neweventlabel);
DateTime yourDateTime = DateTime.Parse(Properties.Settings.Default.DatesEventNames[i]);
DateTime yourDateTime2 = DateTime.Parse(Properties.Settings.Default.DatesEventNames[i + 2]);
ProgressBar pb = new ProgressBar();
pb.Maximum = (yourDateTime - yourDateTime2).TotalDays;
pb.Value = (yourDateTime - DateTime.Now.Date).TotalDays;
pb.Height = 20;
SP1.Children.Add(pb);
}
}
this is what is looks like in the stringcollection
event1<br />
10/01/2013<br />
13/01/2013<br />
event3<br />
12/01/2013<br />
14/01/2013
what this code dose at the moment is grabs every third string in stringcollection so it looks like this
event1<br />
event2
but i want to out a progressbar inbetween them so it looks like this
event1<br />
|-----progressbar-----|<br />
event2<br />
|-----progressbar-----|
right now im trying to give the values to the progressbars. for example I want these vales from event1
Start Date - 10/01/2013<br />
End Date - 13/01/2013<br />
Todays Date - ??/??/????
so for the progress bar it will have
The maximum = (start date to end date)<br />
The Value = (todays date to the end date)
Im having trubble getting the values for the convention in the strings in the dates
So lets say on this line of code
int i = 0;
foreach (string item in Properties.Settings.Default.DatesEventNames)
{
if ((i++ % 3) == 0)
{
}
}
lets say it lands on event2, I want it to get that strings line number lets just say its line 3, then I want it to go down 1 line number, which will make it line 4, and in line 4 would be the date. and this will give me the values. I hope this explains it, please re-read this question in-case you miss something.
Summery
Problem: Finding the values for the datetime in the string collection
Question: Can you help me find the answer to this problem?