Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8375737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:15:12+00:00 2026-06-09T15:15:12+00:00

I have a DataGridView in WinForms. I am programmatically setting the selected row using:

  • 0

I have a DataGridView in WinForms. I am programmatically setting the selected row using:

int index = CompoundListSource.Find("ID", previousAzeotrope.Compound1.ID);
CompoundListSource.Position = index;

For context:

BindingSource CompoundListSource = new BindingSource();
CompoundListSource.DataSource = [A DataTable];

The selection works fine. However, my DataGridView is rather large, so I have it calculate the row heights by listening to its Scroll event. When the DataGridView is scrolled, I call:

GridView.AutoResizeRows(DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders)

As a result of this resizing, the selected row is often no longer among the displayed rows.

It’s not a serious problem, but it’s a nuisance. Does anyone here know how to solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:15:13+00:00Added an answer on June 9, 2026 at 3:15 pm

    You can set the DataGridView’s CurrentCell to ensure a particular cell is in view:

    http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.currentcell.aspx

    You can also set:

    DataGridView.FirstDisplayedScrollingRowIndex = <row index>;
    

    However, this will probably not work in a scroll handler as it actually raises a scroll event itself! I’d give them both a try.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a winforms datagridview that seems to always have at least one row
Using winforms in vs2008. I have a DataGridView and I would like to detect
I'm using c#2.0 and WinForms. I have a datagridview control, unbound, loading small amounts
I'm using EntityFrameowrk 4 and WinForms. I have a DataGridView which shows 5 to
I have a Winforms DataGridView in my application. When the user selects a row
this is for winforms using c# I have a datagridview which lists the email
I have a DataGridView in a Winforms app that has about 1000 rows (unbound)
I have a DataTable which is bound to datagridview (Winforms)... I use the following
I have a column Name Quote Price in a DataGridView winforms control. I can
I have a Winforms app that has a DataGridView that is databound at runtime.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.