2
Answers

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

Ask a question
Joao Rafael

Joao Rafael

12y
1.6k
1
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)