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
1833
Row selection
posted

I need to set the active / selected rows on clicking anywhere on the grid. I was using the following...

Private Sub UGResults_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles UGResults.MouseDown
  Dim mousePoint As New System.Drawing.Point(e.X, e.Y)
  Dim element As UIElement = CType(sender, UltraGrid).DisplayLayout.UIElement.ElementFromPoint(mousePoint)
  Dim cell As UltraGridCell = CType(element.GetContext(GetType(UltraGridCell)), UltraGridCell)
  If Not cell Is Nothing Then
    UGResults.ActiveRow = cell.Row
    cell.Row.Selected = True
  End If
End Sub

However, this cancels the pop-ups of embedded editor controls such as the date time picker. Menaing I can't use them.

What's the alternative?

Thanks!

  • 469350
    Suggested Answer
    Offline posted

    Out of curiosity... why are you using this code at all? The grid already makes the row you click on the ActiveRow. And if you want it to also be selected, you can simply use the CellClickAction property and set it to RowSelect. You don't need any code for that.

  • 37774
    posted

    I'm not really sure that there is an alternative here, since most, if not all, of the dropdown elements will close when they lose focus; I would think that you have this problem even without your code that you posted.

    -Matt