Im quite new to C#, please forgive me if my question is stupid.

Im currently doing a project (alarm clock) and encounter some problems.

I need to know is there anyway to change the Time ("6:02") from textbox or other means instead of changing it from the source code itself.

thanks in advance.

string t1 = DateTime.Parse("6:02").ToString("t");

            string t2 = DateTime.Now.ToString("t");

            if (DateTime.Compare(DateTime.Parse(t1), DateTime.Parse(t2)) < 1)

                Led.BackColor = Color.Black;



                Led.BackColor = Color.Green;


If i got that right, you have a textbox which shows the current Time... So what you need to do is, instead of the hard-coded Time:


You should change your code to this:


Hope i helped,

hi alex..
thanks for the reply..
sorry to say this but that line of code will not work, already tried it before.. :)
anyway this problem is already solved..

thanks again really appreciate it..

This question has already been answered. Start a new discussion instead.