beyond n00b Question - time in c#

Soldato
Joined
6 Jan 2006
Posts
4,663
Location
Newcastle
its annoying me this

Im trying to display current time in a label on my program however it just takes the system time of openning/compiling the app I tried a for loop but that crashed my program Ive tried this method

Code:
                        int hours = DateTime.Now.Hour;
            int minutes = DateTime.Now.Minute;
            int seconds = DateTime.Now.Second;
            int milSeconds = DateTime.Now.Millisecond;

            string timeString = hours + " : " + minutes + " : " + seconds + " : " + milSeconds;

            _timelabel.Text = timeString;

and this method



Code:
            string time;
            time = DateTime.Now.ToString(); 

            _timelabel.Text = "Current Time:" + time;

both with the for loops, tried putting the code in both public and private voids and form load ... and still not a clue


please help :rolleyes:
 
Back
Top Bottom