Joao Rafael

Joao Rafael

  • NA
  • 3
  • 1.9k

Get the value of textbox100, but the textbox100 is in Form2.

Aug 13 2012 4:46 PM
I want to hide a button when the DateTime.Now = a input date by user. The textbox100 is in the Form2 and is already public, but i know something is missing. Need some help please. Thank you.


public void Form1_Load(object sender, EventArgs e)
{
        var dateTimeStr = textbox100.Text;
        var user_time = DateTime.Parse(dateTimeStr);
        var time_now = DateTime.Now;

        if (time_now >= user_time)
        {
        button1.Visible = false;
        }
}

Answers (2)