I wante c# code for (next-previous-first-last)windows form buttons
thank alot
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.
nacro cheickPosted May 6, 2014, 8:27 AM
this is an exemple code
datarow dRow;
int pos;
int maxrecord = ds.Tables[0].Rows.Count;
private void NavigateRecords()
{
dRow = ds.Tables[0].Rows[pos];
txtFirstName.Text = dRow.ItemArray.GetValue(1).ToString();
txtSurname.Text = dRow.ItemArray.GetValue(2).ToString();
txtJobTitle.Text = dRow.ItemArray.GetValue(3).ToString();
txtDepartment.Text = dRow.ItemArray.GetValue(4).ToString();
}
for your next button, increment pos.
exemple
private void Next()
{
if(pos < maxrecord)
{
pos++;
NavigateRecords()
}
}
it's the same for previous.private void goLast()
{
pos=maxrecord;
NavigateRecords()
}