using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Gst_Stg_Navigation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlDataAdapter sqlda = new SqlDataAdapter("select * from stagiaire","data source= . ; initial catalog = ecole ; integrated security= true");
DataSet ds = new DataSet();
int i=0;
private void Form1_Load(object sender, EventArgs e)
{
sqlda.Fill(ds, "Stagiaire");
}
private void btnPrem_Click(object sender, EventArgs e)
{
i = 0;
txtCode.Text = ds.Tables["Stagiaire"].Rows[i][0].ToString();
txtNom.Text = ds.Tables["Stagiaire"].Rows[i][1].ToString();
txtPrenom.Text = ds.Tables["Stagiaire"].Rows[i][2].ToString();
txtCode_Sp.Text = ds.Tables["Stagiaire"].Rows[i][3].ToString();
}
private void btnSuiv_Click(object sender, EventArgs e)
{
if (i < ds.Tables["Stagiaire"].Rows.Count - 1)
{
i++;
txtCode.Text = ds.Tables["Stagiaire"].Rows[i][0].ToString();
txtNom.Text = ds.Tables["Stagiaire"].Rows[i][1].ToString();
txtPrenom.Text = ds.Tables["Stagiaire"].Rows[i][2].ToString();
txtCode_Sp.Text = ds.Tables["Stagiaire"].Rows[i][3].ToString();
}
}
private void btnPrec_Click(object sender, EventArgs e)
{
if (i >0)
{
i--;
txtCode.Text = ds.Tables["Stagiaire"].Rows[i][0].ToString();
txtNom.Text = ds.Tables["Stagiaire"].Rows[i][1].ToString();
txtPrenom.Text = ds.Tables["Stagiaire"].Rows[i][2].ToString();
txtCode_Sp.Text = ds.Tables["Stagiaire"].Rows[i][3].ToString();
}
}
private void btnDern_Click(object sender, EventArgs e)
{
i = ds.Tables["Stagiaire"].Rows.Count - 1;
txtCode.Text = ds.Tables["Stagiaire"].Rows[i][0].ToString();
txtNom.Text = ds.Tables["Stagiaire"].Rows[i][1].ToString();
txtPrenom.Text = ds.Tables["Stagiaire"].Rows[i][2].ToString();
txtCode_Sp.Text = ds.Tables["Stagiaire"].Rows[i][3].ToString();
}
}
}