Within my system I have a text box and button that allows the user to input an integer to the list box. However, I want to include two radio buttons - sorted and unsorted, so that the user has to select whether they want the integer to be sorted or unsorted when added.
This is the code I have so far for the add button;
private void buttonAdd_Click(object sender, EventArgs e)
{
listBoxAddedIntegers.Items.Add(textBoxInsert.Text);
textBoxInsert.Text = string.Empty;
//MessageBox.Show(listBoxAddedIntegers.SelectedIndex.ToString());
MessageBox.Show(listBoxAddedIntegers.Items.Count.ToString());
}
this is the code for the radio button 'sorted;
private void radioButtonSorted_CheckedChanged(object sender, EventArgs e)
{
radioButtonSorted.Checked = true;
}
and this is the code for the 'unsorted' radio button -
private void radioButtonUnsorted_CheckedChanged(object sender, EventArgs e)
{
radioButtonSorted.Checked = false;
}
Does anyone have any suggestions on how to add an integer to the list, so that when the user selects the radio button 'sorted' and then clicks add integer, the integer is then added to the sorted list? Thank you.