Delete Highlighted Record instead of Selected Record

Dear Sir:

I use this code to delete selected record row, if I expand mouse selection rows to several rows, it just can only select one record each time, thus delete one row each BtnDelete_click event.
I expect to enumerate each highlighted (alpha blend) rows and then delete it all, but didn't have idea to work it out.

GGC.TableOptions.AllowSelection = GridSelectionFlags.None
GGC.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended

Sub BtnDelete_Click()
Dim el As Element = GGC.Table.GetInnerMostCurrentElement()
If Not el Is Nothing Then
Dim rec As Record = el.GetRecord()
rec.Delete()
End If
End Sub

How to make it work perfectly in VB?

Best Regards,
Harry


3 Replies

SR Sri Rajan Syncfusion Team April 11, 2008 11:06 PM UTC

Hi Harry,

Thank you for your patience.

To delete all the highlighted s n GroupingGrid, Please refer the code below.


Private Sub buttonAdv1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim selRecords As Syncfusion.Grouping.SelectedRecordsCollection
selRecords = Me.gridGroupingControl1.Table.SelectedRecords

For Each record As Syncfusion.Grouping.SelectedRecord In selRecords
record.Record.Delete()
Next record
End Sub


Please let me know if this helps.

Best Regards,
Srirajan




HA harisan April 19, 2008 02:03 AM UTC

Hello Srirajan,

Thanks, but it only worked on parent table, I need to delete selected records work on child or nested tables as well.
How to work it out?

Best Regards,
Harry



JO Johnson Syncfusion Team April 23, 2008 11:03 PM UTC

Hi Harry,

To delete ChildTable records when selected, you need to get the selected records from the corresponding table. The code's are below,

Private Sub buttonAdv1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim selRecords As Syncfusion.Grouping.SelectedRecordsCollection
Table tab = Me.gridGroupingControl1.GetTable("ChildTable Name")
selRecords = tab .SelectedRecords

Dim i As Integer = selRecords.Count
Do While i < 0
i -= 1
selRecords(i).Delete()
Loop
End Sub


Please let me know if you need further assistance.

Best regards,
Johnson




Loader.
Up arrow icon