private void button1_Cli2k(object sender, EventArgs e)
{
int num = 0;
if (listBox1.Items.Count > 0)
{
num = listBox1.SelectedIndex;
MessageBox.Show(listBox1.SelectedItem.ToString() + "죽습니다"); //selecteditem??
if (num >= 0) listBox1.Items.RemoveAt(num);
num = listBox1.Items.Count - 1;
listBox1.Items.RemoveAt(num);
listBox1.Items.Remove("1212"); //revome는 내가 원하는것만 지울수 있음
}
}
listbox에 지울게 없는데 지우라고 하면 에러 나잖아?
그거를 막는 코딩인데
이해가 안가네 자세히 설명점 해주실분... 왜 num >= 0 이여야되는거고
count - 1은 또뭔지;;;
댓글 0