Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a problem when I'm scrolling a datagrid and the cell moves out of the current view of the grid, the grid loses focus and the control with next tab index is focused.

 

This then makes the grid no longer scrollable with the wheel because it is not focused any longer.

 

Any suggestions on making the focus stay on the grid even when the current row/cell is not in view so it can be scrolled by it's entirety with the mouse wheel?

  • *Experts*
Posted (edited)

If you capture the total number of rows as below:

 

 


Dim numRows as Integer = Me.BindingContext(dataGridDetails.DataSource, dataGridDetails.DataMember).Count;

 

can you then compare the current selected row to the count and keep focus?

 

Jon

Edited by jfackler
  • 6 months later...
  • 1 month later...
Posted

Datagrid Loses Focus When Wheel Scrolls

 

This worked for me:

 

Private Sub DataGrid1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseWheel

DataGrid1.Focus()

End Sub

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...