Link to home
Start Free TrialLog in
Avatar of mpdalton
mpdalton

asked on

Scroll Datagrid

i have a simple bit of code that takes a value as selects that row in a datagrid.

what my problem is that if row that gets selected is not necessarily visible, it make be row 200 for example, and only rows 1-10 are visible. How do i scroll the datagrid so my selected row is visible ??


  Public Shared Sub SelectRow(ByVal dg As DataGrid, ByVal LookFor As String, ByVal LookInColumn As Int32)
    Dim i As Int32

    Try
      For i = 0 To dg.DataSource.rows.count - 1
        If TDS.Functions.General.fStr(dg.Item(i, LookInColumn)) = LookFor Then
          dg.Select(i)
        End If
      Next
    Catch ex As Exception

    End Try
  End Sub

ASKER CERTIFIED SOLUTION
Avatar of tovvenki
tovvenki

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mpdalton
mpdalton

ASKER

thanks tovvenki, works perfectly.