graphics don't draw when loop condition is dates. c#, winForms

Posted by jello on Stack Overflow See other posts from Stack Overflow or by jello
Published on 2010-03-31T03:11:39Z Indexed on 2010/03/31 3:13 UTC
Read the original article Hit count: 420

Filed under:
|
|

so i got this piece of code. (currPosX is defined earlier)

while (earliestDate < DateTime.Today)
        {
            currPosX = currPosX + 5;
            e.Graphics.DrawLine(Pens.Black, currPosX, 0, currPosX, 10);

            earliestDate = earliestDate.AddDays(1);
        }

the graphics don't draw. it's really weird, since this only happens when the condition statement is a date comparison. I debugged, and it does go in the loop, and the values are messed with (currPosX for example). But, no display. one more weirdness, if I add a MessageBox.Show("blabla") in the loop, the message box pops up, and graphics are drawn. what's going on here?

© Stack Overflow or respective owner

Related posts about c#

Related posts about graphics