我不知道如何在文本框中添加值。这是代码:
private void starecivilaComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (starecivilaComboBox.SelectedIndex == 0)
{
MessageBox.Show("This selection is not valid!");
}
else if (starecivilaComboBox.SelectedIndex == 1)
{
int score = 4;
}
else if (starecivilaComboBox.SelectedIndex == 2)
{
int score = 1;
}
else if (starecivilaComboBox.SelectedIndex == 3)
{
int score = 3;
}
else if (starecivilaComboBox.SelectedIndex == 4)
{
int score = 2;
}
}
我想在文本框中插入分数的值,所以它会显示我从组合框中选择的每个项目的分数。我试过这个:
private void scoringTextBox_TextChanged(object sender, EventArgs e)
{
scoringTextBox.Text = score.toString();
}
但它不承认它。错误是:此上下文中不存在名称“score”。我怎样才能使这项工作?
谢谢你。