Windows Develop Bookmark and Share   
 index > Windows Forms Designer > issue : Grid Scrollbar maintain scroll bar position after refresh Grid
 

issue : Grid Scrollbar maintain scroll bar position after refresh Grid

Hi, I am refilling DatagridView control after 3 seconds.. but after loading it.. want to maintain the scroll bar position of the grid. How I can do that?
Tejaswini Prashant J  Friday, October 02, 2009 12:30 PM

Provide some more details about your requirement.

According to my understanding, you are trying to do some function with the grid scroll bar after each loading of grid.

You can check the properties(intellisense) which suit your requirement.

eg.,

datagridview1.ScrollBars.equals

Rohini Chavakula  Monday, October 05, 2009 1:46 PM

Hi,

 

You can set the following two properties in Timer.Tick event.

 

datagridview.FirstDisplayedScrollingRowIndex

Gets or sets the index of the row that is the first row displayed on the DataGridView.

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

 

DataGridView.FirstDisplayedScrollingColumnIndex Property

Gets or sets the index of the column that is the first column displayed on the DataGridView.

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

 

        int i = 0;

        void timer1_Tick(object sender, EventArgs e)

        {

            i++;

            int k = dataGridView1.FirstDisplayedScrollingRowIndex;

 

            if (i % 3 == 0)

            {

                dataGridView1.DataSource = null;

                dataGridView1.DataSource = dt01;

           

            }

            dataGridView1.FirstDisplayedScrollingRowIndex = k;

        }

 

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Thursday, October 08, 2009 4:23 AM

You can use google to search for other answers

Custom Search

More Threads

• IDE Crash Using Inherited Forms in C#/VS2005
• Creating Control at Runtime
• problem wid datagridcolumnstyle ... urgent
• How to resize the window form control dynamically
• How to add Backgroung Image of panel at particuler position
• Designer will not open after downloading new VB 2008
• xp style or VS controls
• Cannot Make Changes to Forms via Designer: "Error HRESULT E_FAIL has been returned from a call to a COM component."
• Cannot publish because a project failed to build.
• ComponentsCreated & ComponentsCreating events not firing from IToolboxService Drag & Drop