我的标签文本不会在加载表单时改变
My labels text wont change on loading form
我尝试在 form_load 和 form_shown 方法中更改我的标签文本,但没有任何反应。我不想在属性中设置文本,因为我想稍后在另一个标签中使用文本。这两种方法我都试过了,都不行。
private void History_Load(object sender, EventArgs e)
{
populateHistoryQuestionArray();
historyQ1.Text = historyQuestion[0];
}
和
private void History_Shown(object sender, EventArgs e)
{
populateHistoryQuestionArray();
historyQ1.Text = historyQuestion[0];
}
您必须添加ToString()
private void History_Load(object sender, EventArgs e)
{
populateHistoryQuestionArray();
historyQ1.Text = historyQuestion[0].ToString();
}
我尝试在 form_load 和 form_shown 方法中更改我的标签文本,但没有任何反应。我不想在属性中设置文本,因为我想稍后在另一个标签中使用文本。这两种方法我都试过了,都不行。
private void History_Load(object sender, EventArgs e)
{
populateHistoryQuestionArray();
historyQ1.Text = historyQuestion[0];
}
和
private void History_Shown(object sender, EventArgs e)
{
populateHistoryQuestionArray();
historyQ1.Text = historyQuestion[0];
}
您必须添加ToString()
private void History_Load(object sender, EventArgs e)
{
populateHistoryQuestionArray();
historyQ1.Text = historyQuestion[0].ToString();
}