Page Count Errors

Sometimes, you will be programmatically changing tables or the number of rows, and binding them to an existing datagrid. If you have a higher page number selected when one of these changes happens, you will get a page count error like this:
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.

To fix this, do a Try/Catch error routine like this:

With MyDataGrid  Try   binddata  ' where binddata is a databinding routine  Catch    .currentpageindex=0      binddata  End Try end with 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>