I have a access database from where I am populating the datagridview on button click event. but what I exactly I want to add record of access database in datagridview when button is clicked. Means on 1st click 1 record should be add in datagridview, on 2nd click another record should be add and so on...

What modification I need to make in my code, please guide me

        private void button1_Click(object sender, EventArgs e)
        {
            aCommand3 = new OleDbCommand("select * from batch_tbl", main_connection);
            aAdapter3 = new OleDbDataAdapter(aCommand3);

            ds3 = new DataSet();
            aAdapter3.Fill(ds3, "app_info");

            ds3.Tables[0].Constraints.Add("pk_bno", ds3.Tables[0].Columns[0], true);
            int batch_count = ds3.Tables[0].Rows.Count;

            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.DataSource = ds3.Tables[0];
        }

Thank you everybody for any advice/suggestion

Hmm, never worked with Access databases before, but couldn't you use some sort of incrementer that kept track how many times the button is clicked?

Now for dataGridViews all you need to do is do something like

dataGridView1.Rows.Add(); //adds a new row

dataGridView1 [i, (dataGridView1.Rows.Count - 1)].Value = "";
    // i would the # for which column you want to access, so you'll have to do with that as 
    // you want, but this will add to the last row in the dataGridView, well you'd have to 
    // replace the "" with whatever data you want to add

You'd just use this everytime the button is clicked (well you might want a check to make sure that there's still data being pulled from the database).

This help at all (sorry if it seems a little rushed)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.