Solved

simulate scroll for datagrid

Posted on 2006-11-14
3
244 Views
Last Modified: 2010-05-18
Hi, i have a datagrid...how could i make it in such a way that when i click on a button it will scroll down or up?

thanks
0
Comment
Question by:jaxrpc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Accepted Solution

by:
Hillwaaa earned 500 total points
ID: 17944846
Hi jaxrpc,


I found this at (http://www.windowsforms.net/FAQs/default.aspx?PageID=2&ItemID=538&CategoryID=3&tabindex=3).  You should be able to use this to create a custom scrollable datagrid, just keep an integer in your form that keeps track of the current row.

Dim currentRow as integer = 0

'This is the scroll down button code
Private Sub downButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles downButton.Click
    currentRow += 1
    Me.yourDataGrid.ScrollToRow(currentRow)
End Sub



How do I programmatically scroll a DataGrid to a particular row?      

The DataGrid has a protected GridVScrolled member that can be used to scroll the grid. To use it, you can derive from DataGrid and add a ScrollToRow method. Here is a code snippet.

Public Class MyDataGrid
    Inherits DataGrid
  Sub ScrollToRow(ByVal row As Integer)
    If Not Me.DataSource Is Nothing Then
      GridVScrolled(Me, New ScrollEventArgs(ScrollEventType.LargeIncrement, row))
    End If
  End Sub
End Class

Daniel Herling, Microsoft

Cheers,
Hillwaaa
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question