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;

            }

            else
            {

                Led.BackColor = Color.Green;

            }

Edited 6 Years Ago by DizzyHead: n/a

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:

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

You should change your code to this:

DateTime.Parse(TextBox1.Text).ToString("t");

Hope i helped,
Alex

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.