The reason is that the item is being added in
SelectedIndexChanged
event of
resultsListBox
as given in the question
private void resultsListBox_SelectedIndexChanged(object sender, EventArgs e)
{
resultsListBox.Items.Add(answer.ToString());
}
If the result is required to be added when the
rollButton
is clicked, then add the item
resultsListBox.Items.Add(answer.ToString());
in the
Click
event of
rollButton
,
rollButton_Click
event.