?
Solved

How do I use FirstDisplayedScrollingRowIndex on the fly?

Posted on 2007-11-26
1
Medium Priority
?
2,824 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 2000 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: 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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month11 days, 18 hours left to enroll

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