Solved

simulate scroll for datagrid

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net checkbox 7 47
VS.net 2010 11 36
Close form "before" open 3 41
Help with preventing downloading a zip file 10 37
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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