//When clicked on a button on this form this class will show a form to renew the license
private void button1_Click(object sender, EventArgs e)
{
Notif f = new Notif();
f.Show();
int b =
//how to get the value from Valid class
}
//This is the class of a form which will display a renew button to renew the license
private void button1_Click(object sender, EventArgs e)
{
int d = DateTime.Now.Day;
this.Close();
//how to pass this date to form1 class...??
}
//This is the class to capture the value of the day sent from the renew button of the above class
public static class Valid
{
public int day { get; set; }
}
我正在寻找问题的解决方案,即,如果单击了更新按钮,如何在Form1类中获取当天的值。?
您可以阅读每个课程中提到的注释,您将理解问题
答案 0 :(得分:0)
因此,您想将int d发送到Valid类,然后将其发送到int b = ...?
public static class Valid
{
public static int _day; /* if you have setters and getters
with day and you dont want a stack overflow you need _day*/
public static int day {get{return _day; } set{_day=value;}}
}
这是表单的类别,该表单将显示用于更新许可证的续订按钮
public int alternative_d;
private void button1_Click(object sender, EventArgs e)
{
int d = DateTime.Now.Day;
Valid.day=d;
alternative_d=d;
this.Close();
//how to pass this date to form1 class...??
}
当单击此表单上的按钮时,该课程将显示一个续订许可证的表单
private void button1_Click(object sender, EventArgs e)
{
Notif f = new Notif();
f.ShowDialog(); /*<-- use show dialog, your code resumes at next line when f is closed*/
int b = Valid.day;//how to get the value from Valid class
int b= f.alternative_d; //either one or the other; no extra class needed
}