在不同的网格视图中删除同一行

问题描述 投票:0回答:1

[如果我有两个镜像的GridView,也就是说它们是相同的,如何删除两个GridView中的同一行?也就是说,如果删除Gridview1中的第7行,则第7行将在[ C0]。

我编写了此代码。

GridView2

请,您能指导我这样做吗?

谢谢您。

winforms gridview devexpress
1个回答
0
投票

您可以绑定相同的源,如果删除了一行,则另一行也将删除。

或者您可以处理 Dim UnitIndex As Integer() Dim selectedRows() As Integer = GridView1.GetSelectedRows() For Each rowHandle As Integer In selectedRows If rowHandle >= 0 Then UnitIndex = GridView1.GetSelectedRows End If Next rowHandle Dim p As Integer = UnitIndex GridView2.DeleteRow(p) 。当删除该项目时,删除另一个。

您的代码就是这样。

ListChanged Event
© www.soinside.com 2019 - 2024. All rights reserved.