I have an application that, when a certain action occurs, the exact DATE/TIME is written as myTime using the Visual studion configuration manager where you can add settings.
This is my setting : Properties.Settings.Default.voteTime
I want as soon as my application starts to show a label that will display "X time left until next vote request"
In my context, the votes must be done each 12 hours so
I want the label to basically show how much time is left from those 12 hours, starting from the voteTime I mentionned above.
I have tried many techniques but I'm a noob at C# and noone worked for me, each time the label either had his default text or was blank...
DateTime voteTime = Properties.Settings.Default.voteTime;
DateTime startDate = DateTime.Now;
//Calculate countdown timer.
TimeSpan t = voteTime - startDate;
string countDown = string.Format("{0} Days, {1} Hours, {2} Minutes, {3} Seconds til launch.", t.Days, t.Hours, t.Minutes, t.Seconds);
Above, that is what I tried then I wrote label1.text = countDown;
Thanks in advance.