private void Previous_Click(object sender, EventArgs e)
{
currentPage = currentPage - 1;
if ((currentPage < 1))
{
MessageBox.Show("You are at the First Page!");
currentPage = 1;
return;
}
else
{
recNo = (pageSize
* (currentPage - 1));
}
LoadPage();
}
private void Next_Click(object sender, EventArgs e)
{
if ((pageSize == 0))
{
MessageBox.Show("Set the Page Size, and then click the \"Fill Grid\" button!");
return;
}
currentPage = (currentPage + 1);
if ((currentPage > PageCount))
{
currentPage = PageCount;
if ((recNo == maxRec))
{
MessageBox.Show("You are at the Last Page!");
return;
}
}
LoadPage();
}
Note: LoadPage() Should be Defined by yourself!!