Solved

How do I use FirstDisplayedScrollingRowIndex on the fly?

Posted on 2007-11-26
1
2,658 Views
Last Modified: 2012-05-05
Hi there, I have some code below which will make the first displayed row in my datagrid whatever row my mouse is currently clicked on.

Is there a way to change it so that "row" variable could contain a number that I choose so that, say, when I click Button3 it always sets "row" as the tenth row in the datagrid even though no row is selected by the mouse etc?

I tried changing to Dim row as Integer = "10" but I get an error that CurrentRow cannot be set to an integer.

Thanks everyone


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim row As DataGridViewRow
        row = JackBennyDataGridView.CurrentRow
        JackBennyDataGridView.FirstDisplayedScrollingRowIndex = JackBennyDataGridView.Rows.IndexOf(row)
    End Sub

Open in new window

0
Comment
Question by:BIGZIPZ1
[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
1 Comment
 
LVL 3

Accepted Solution

by:
JeffvClayton earned 500 total points
ID: 20356835
 Dim iRow As Integer
        iRow = 10

       JackBennyDataGridView.FirstDisplayedScrollingRowIndex = iRow

This should work without any problem. I notice you have "10" instead of 10  (ie. there should be no quotes)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
How to limit User Input 2 33
Visual studio 2015 1 35
VB.NET Application Installation with sqlserver 8 47
visual studio vb.net windows onkeyup 2 30
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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