TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Scott G
NA
103
7.7k
coding a Next button to advance to next row of data table
Oct 16 2018 2:57 PM
I have a form with two panels. A button click makes my second panel visible which has several textboxes bound to a database through the use of a DataTable and SqlDataAdapter.
private void btnViewAgents_Click(object sender, EventArgs e)
{
pnlAgents.Visible = true;
SqlCommand SelAgts = new SqlCommand("SELECT * FROM myTable ORDER BY last_name", misc);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(SelAgts);
da.Fill(dt);
misc.Open();
txtLName.Text = dt.Rows[0]["last_Name"].ToString();
txtFName.Text = dt.Rows[0]["first_name_mi"].ToString();
txtAgt.Text = dt.Rows[0]["agency_use"].ToString().Substring(0, 5);
txtStore.Text = dt.Rows[0]["agency_use"].ToString().Substring(6, 19);
...
...
misc.Close();
}
I now have two other buttons on this panel, next and previous that I need to have move to the next or previous row in the table. So basically on the next button click I need each textbox to advance from row 0 to 1 and so on with each click.
Reply
Answers (
5
)
Custom RoleProvider, Authorization, EF DB First and ASP.NET
how to upload multiple video in single button click