LoginSignup
1
1

More than 5 years have passed since last update.

listbox から選択された複数項目を削除

Last updated at Posted at 2017-01-02

C++で.net Frameworkのフォーム(Form)のリストボックス(ListBox)のオブジェクトlistboxから選択された複数の項目を削除します。

int selectedNum = listBox1->SelectedIndices->Count;
for (int i = selectedNum-1; i > -1; i--) {
  listBox1->Items->Remove(listBox1->SelectedItems[i]);
}

デフォルトでlistboxを作成すると単一項目しか選択できないので、以下のコードをlistboxに追加する。

this->listBox1->SelectionMode = SelectionMode::MultiExtended;
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1