The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have to dynamically add/remove columns in a grid, allowing removing all columns and insert different ones. The following problem occurs:
1. Insert a GridControl in a form, and a Label in the GridControl.
2. Set GridControl.ListBoxSelectionMode = MultiExtended
3. After having written the following code, select a row and click on the label. The selection breaks.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.GridControl1.ColCount = 2
End Sub
Private Sub Label1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.Click
Me.GridControl1.BeginUpdate()
Dim cnt As Integer = Me.GridControl1.ColCount + 1
Me.GridControl1.ColCount = 0
Me.GridControl1.ColCount = cnt
Me.GridControl1.EndUpdate()
End Sub
ADAdministrator Syncfusion Team December 6, 2005 06:54 PM UTC
I think you can avoid this problem using this code.
Me.GridControl1.BeginUpdate()
Dim cnt As Integer = Me.GridControl1.ColCount + 1
Dim ranges As GridRangeInfoList = Me.GridControl1.Selections.GetSelectedRows(True, False)
Me.GridControl1.ColCount = 0
Me.GridControl1.ColCount = cnt
For Each r As GridRangeInfo In ranges
Dim range As GridRangeInfo = r
range = GridRangeInfo.Rows(range.Top, range.Bottom)
Me.GridControl1.Selections.Add(range)
Next
Me.GridControl1.EndUpdate()