Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
Unable to force the grid to only allow a single selected row.
posted

I am trying to force my grid to only allow the user to select a single row at a time.  Which seems fairly straightforward, but I can't seem to find the right cocktail of properties to completely accomplish this.

I'm using Infragistics v3 2008 and I have the following code happening with a clean UltraGrid straight out of the toolbox.

The problem is when I click on a row, hold down the mouse button and drag it upwards or down.  I now have two rows selected, but I only want one.

How can I force this grid to only allow a single selected row on screen?

 

 

Public Class Form1

 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim odt As New DataTable("Table")

        odt.Columns.Add(New DataColumn("Col1", GetType(String)))

        odt.Columns.Add(New DataColumn("Col2", GetType(String)))

        odt.Columns.Add(New DataColumn("Col3", GetType(String)))

 

        odt.Rows.Add("Happy", "Joy", "Joy")

        odt.Rows.Add("Happy", "Joy", "Joy")

        odt.Rows.Add("Happy", "Joy", "Joy")

        odt.Rows.Add("Happy", "Joy", "Joy")

        ug.DataSource = odt

 

    End Sub

 

    Private Sub ug_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ug.InitializeLayout

        ug.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect

        ug.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Single

 

    End Sub

 

 

End Class