更新时间:2021-09-23 22:21:32
获取列表框中的所有项目:
Get all the items of the listbox :
foreach (DataRowView drv in listBox1.Items)
{
int id= int.Parse(drv.Row[listBox1.ValueMember].ToString());
}
取决于绑定DataGridView的方式以及实际需要更新现有行还是添加新行,您需要使用列表框中的值来执行此操作。
Depending on how you bind your DataGridView and if you actually need to update existing rows or add new rows, you need to use the values from the listbox to do so.