我在下面有两个textchanged代码:
#region Tasklist Percentage
private void TaskListAccomplishmentPrcentagetextBox_TextChanged(object sender, EventArgs e)
{
string tl = TaskListAccomplishmentPercentagetextBox.Text;//breakpoint here(has value)
if (tl != null)
{
if(tl == "0%")
{
TaskListAccomplishmentPercentagetextBox.BackColor = Color.FromArgb(255, 150, 150);
TaskListAccomplishmentPercentagetextBox.ForeColor = Color.FromArgb(0, 0, 0);
}
else if (tl == "100%")
{
TaskListAccomplishmentPercentagetextBox.BackColor = Color.FromArgb(0, 204, 0);
TaskListAccomplishmentPercentagetextBox.ForeColor = Color.FromArgb(0, 0, 0);
}
else if (tl == "N/A")
{
TaskListAccomplishmentPercentagetextBox.BackColor = Color.FromArgb(0, 204, 0);
TaskListAccomplishmentPercentagetextBox.ForeColor = Color.FromArgb(0, 0, 0);
}
}
}
#endregion
#region Compute Total Completion Percentage
private void TotalCompletionPercentagetextBox_TextChanged(object sender, EventArgs e)
{
string tl = TaskListAccomplishmentPercentagetextBox.Text;//if breakpoint is here(has null value)
string lpi = SLACompliancePercentageLPItextBox.Text;
}
#endregion
当我在任务列表区域TaskListAccomplishmentPercentagetextBox.Text
上的断点值显示0%
但是当我在计算总点击区域TaskListAccomplishmentPercentagetextBox.Text
上放置断点时,值显示
null
或空的。
TaskListAccomplishmentPercentagetextBox.Text
的用户输入值为0%
,显示何时运行该程序。问题是显示的计算区域的值,我无法使用它来创建计算。
我是否必须声明值,调用等值以手动显示在计算总区域中?在我的其他textchanged计算中导致此问题不会发生。任何帮助或意见都表示赞赏。