User Navigation in C# - (First and Last Buttons)

This is the continuation of my tutorial which is User Navigation in C# (Next and Previous Buttons). I added two functions, wherein you can retrieve the first and last record in the table. This is a big help for you when you have to know exactly what are the records in the first and the last row of the table in an easy way. Let’s begin

Step 1

Open the file which is User Navigation in C# (Next and Previous Buttons).

Step 2

Add two buttons and named it “btnFirst” and “btnLast”. Arrange the button just like shown below. ps2

Step 3

Double click the “First” button and do the following codes to retrieve the first row in the table.
  1.  
  2. private void btnFirst_Click(object sender, EventArgs e)
  3. {
  4. inc = 0;
  5. sql = "SELECT * FROM `tbl_user`";
  6. navigate_records(sql, inc);
  7. }

Step 4

Double click the “Last” button and do the following codes to retrieve the last row in the table.
  1.  
  2. private void btnLast_Click(object sender, EventArgs e)
  3. {
  4. inc = maxrow;
  5. sql = "SELECT * FROM `tbl_user`";
  6. navigate_records(sql, inc);
  7. }
The complete source code is included. You can download it and run it on your computer. For any questions about this article. You can contact me @ Email – [email protected] Mobile No. – 09305235027 – TNT Or feel free to comment below.

Add new comment