텍스트 상자와 버튼을 통해 목록에 정수를 추가하는 프로그램이 있습니다. 또한 사용자가 정렬 된 방식으로 목록 상자에 항목을 추가하거나 정렬되지 않은 방식으로 항목을 추가 할 수있게하는 2 개의 라디오 버튼을 포함하고자합니다. 사람이 어떻게 (그 '사용자가 선택한 경우 radSorted 있도록 성명을 발표하는 생각도 않고,정렬 및 정렬되지 않은 라디오 버튼을 사용하여 정수에 목록 추가 C#
if (radSorted.Checked)
lstIntegers.Items.Add(SortedList < SortOrder>);
나에게 오류를주고있다
private void btnInsert_Click(object sender, EventArgs e)
{
int acceptedNum = 0;
if (!string.IsNullOrEmpty(txtInsert.Text))
{
if (!(lstIntegers.Items.Contains(txtInsert.Text)))
{
if (!(int.TryParse(txtInsert.Text, out acceptedNum) && acceptedNum <=0 || acceptedNum >= 100))
{
lstIntegers.Items.Add(txtInsert.Text);
txtInsert.Clear();
txtInsert.Focus();
bubbleSort();
}
else
{
MessageBox.Show("Please input value between 1-100", "error", MessageBoxButtons.OK);
txtInsert.Text = "";
txtInsert.Focus();
return;
}
}
else
{
MessageBox.Show("Number already exists in list", "error", MessageBoxButtons.OK);
}
}
else
{
MessageBox.Show("Please input value between 1-100", "error", MessageBoxButtons.OK);
txtInsert.Focus();
return;
}
if (lstIntegers.Items.Count == 30)
{
MessageBox.Show("Maximum number of entries exceeded", "error", MessageBoxButtons.OK);
//button enabled was false however couldn't then add another
btnInsert.Enabled = true;
}
if (radSorted.Checked)
lstIntegers.Items.Add(SortedList < SortOrder>);
}
라인 - 이것은 내가 지금까지 가지고있는 코드입니다 라디오 버튼 정렬), 정렬 된 목록에 정수를 추가하십시오. 그렇지 않은 경우 사용자가 radUnsorted (라디오 버튼을 정렬하지 않음)를 선택한 다음 목록의 끝 부분에 정수를 추가합니까? 감사합니다. .
당신은 무엇을 ... 당신은 단지'_one_ 한 의미 lstIntegers'. 정렬 된 목록은 어디에 있습니까? 정확히 무엇을하고 싶니? 이 lstIntegers가 갑자기 정렬되어야합니까? 분류되지 않은 경우 다음 값을 어떻게 "정렬"할까요? –
하나의 목록 만 가지고 있지만 사용자가 '정렬 된'라디오 버튼을 선택하면 목록의 항목을 정렬하고 싶습니다. 정렬되지 않은 상태에서 사용자가 다른 정수를 추가하고 목록을 정렬하도록 변경하려면 전체 목록에서 원하는 항목을 정렬합니다. – hayley
정렬되지 않은 버튼은 정수를 목록 끝에 추가 할 수있게합니다. 그러나 만약 내가 너무 많이 누른 다음 그것을 단순화 할 수있는 정렬 된 단추를 누른 다음 정렬됩니다 목록 정렬됩니다 및 정렬되지 않은 단추를 선택한 경우 다음 정수를 그냥 파일 끝에 추가됩니다 바란다 더 의미. – hayley