Binding navigator using C# windows form application

 Binding navigator using C# windows form application


Data Binding Navigator Using Next Add Delete

  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 Data_Binding_Nav

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

        SqlDataAdapter da;

        DataSet ds;

        private void Form1_Load(object sender, EventArgs e)

        {

            // TODO: This line of code loads data into the 'cotDataSet.stu' table. You can move, or remove it, as needed.

            this.stuTableAdapter.Fill(this.cotDataSet.stu);

            SqlConnection con = new SqlConnection("Data Source=THIRU-PC\\SQLEXPRESS;Initial Catalog=cot;Integrated Security=True");

       da = new SqlDataAdapter("select * from stu",con);

            ds = new DataSet();

            da.Fill(ds);

            stuBindingSource.DataSource = ds.Tables[0];

            bindingNavigator1.BindingSource = this.stuBindingSource;

           

            textBox1.DataBindings.Add(new Binding("Text", stuBindingSource, "id", true));

            textBox2.DataBindings.Add(new Binding("Text", stuBindingSource, "name", true));

            textBox3.DataBindings.Add(new Binding("Text", stuBindingSource, "gender", true));

           textBox4.DataBindings.Add(new Binding("Text", stuBindingSource, "mobile", true));

           

        

    }

    }

}

 

 



Post a Comment

0 Comments