Solved

simulate scroll for datagrid

Posted on 2006-11-14
3
243 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Toolbar to format all windows forms controls at design time needed 5 34
Access Schema 6 58
ModalPopup  question 22 58
YouTube API get the Video Tags - vb.net 7 54
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

752 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