How to retrieve selected values for selected items in a ListBox?

后端 未结 3 983
傲寒
傲寒 2021-01-25 07:23

I\'m populating a ListBox in a WinForms application, this way:

listBoxUsers.DataSource = ctx.Users.ToList();
listBoxUsers.DisplayMember = \"Name\";
listBoxUsers.         


        
3条回答
  •  面向向阳花
    2021-01-25 08:04

    Have you tried with the SelectedItems property?

    foreach (var item in listBoxUsers.SelectedItems)
    

    {

    }

提交回复
热议问题