Results 1 to 4 of 4

Thread: [2005] How to automatically display a row (by scroll) in datagridview

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Posts
    110

    [2005] How to automatically display a row (by scroll) in datagridview

    In VB6, I got the following codes, how to do the same in VB 2005?
    It set the rows(i) to be displayed in screen. but in VB.net, there is no TopRow.

    vb.NET Code:
    1. If (Grid.RowIsVisible(i) = False) Then
    2.                     If (Grid.Rows - 7) < i Then
    3.                         Grid.TopRow = (frm_korea.KRIDMapGrid.Rows - 7)
    4.                     Else
    5.                         Grid.TopRow = i
    6.                     End If
    7.                 End If

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] How to automatically display a row (by scroll) in datagridview

    It's not really that in VB.NET there's no TopRow. It's the fact that you're using a completely different control so, regardless of the language, the members of your old control are irrelevant.

    What control ARE you using? A DataGridView I assume. Have you read the documentation for the DataGridView to see what members it DOES have? Wouldn't that be the place to start? If you do so you'll see the specific property that does the very same job as that TopRow.

    You can wait for someone else to tell you what it is if you want, but if you use the doco and find it for yourself then you'll see how easy it is, then you'll be able to do the same in future. That's learning and that's how you get better.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Posts
    110

    Re: [2005] How to automatically display a row (by scroll) in datagridview

    Your opinion sounds good.

    I handle this by setting current cell. It comes to my goal though not exactly the same function of TopRow.

    However, there are some problems that the doc cannot help a lot, like my another thread

    DataGridViewRow locating

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] How to automatically display a row (by scroll) in datagridview

    The actual property that is the same as TopRow is FirstDisplayedScrollingRowIndex, described in the documentation thusly:
    Gets or sets the index of the row that is the first row displayed on the DataGridView.
    You'll never never know if you never never look. That was an Australian advertising campaign so I don't expect you'll get the reference. Sounds cool to an Aussie though.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width