I want to navigate to a record in Datagridview by selecting/click on a record without using a button click.
and display a record number,or current record number.
Please help here is my code snippet.
private void labelUpdate()
{
if (hwdg.SelectedRows.Count>=inc)
{
hwdg.FirstDisplayedScrollingRowIndex = inc;
hwdg.Rows[inc].Selected = true;
//inc++;
label27.Text = "Record" + (inc + 1) + " of " + ds2.Tables["tblComp"].Rows.Count;
}
else if(hwdg.SelectedRows.Count<=inc)
{
hwdg.Rows[inc - 1].Selected = true;
label27.Text = "Record" + (inc + 1) + " of " + ds2.Tables["tblComp"].Rows.Count;
}
}
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Madito KevinPosted May 10, 2015, 12:18 PM
Madito KevinPosted May 6, 2015, 3:32 PM
IsraelPosted Apr 7, 2015, 9:09 AM
Listen, this example use a MS ACCESS database.
public partial class Facturacao : Form