Click here to Skip to main content
13,139,254 members (86,610 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I have one more problem. In my grid view the scorll bar is not match with no.of records that is if i scroll the gridview after the record is completed it give me the error saying that "Operation is not valid due to the current state of the object". i want the scroll to restrict to the exact no.of records so i cant able to scroll more once the record is in last.

Posted 16-Dec-12 19:42pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you enable VirtualMode then this may Happen,
Set VirtualMode property of GridView Control to False
DataGridView1.VirtualMode = False
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Actually i have some problem with my code. I assigned multiple times the dgv.rowcount property inside my code that causes me the problem. After removing one of the line it works for me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 17 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100