Binding Data to DataGridView - don't select a row

Hi, I'm binding data to a DataGridView:

DataView dv = ss.GetAllCenterLevels(_stockCenterID).Tables[0].DefaultView;

dgvStockLevels.DataSource = dv;

This works fine and data is bound to the DataGridView fine. However the first row is automatically select, How do I bind the gird so no rows are selected (I want the user to select the row)

Thanks



Answer this question

Binding Data to DataGridView - don't select a row

  • Grmplse

    may be you can try:

    private void Autoselect_Load(object sender, EventArgs e)

    {

    Table_AB TBC = new Table_AB();

    DataTable TB = TBC.GetTable();

    this.dataGridView1.DataSource = TB.DefaultView;

    this.dataGridView1.Rows[0].Cells[0].Selected = false;

    }



  • RussellH

    Or use the ClearSelection method of the DataGridView.

    http://msdn2.microsoft.com/en-us/library/bxdf3ekh.aspx

    Greetz,

    Geert

    Geert Verhoeven
    Consultant @ Ausy Belgium

    My Personal Blog



  • Vishal_pai

    this.dataGridView1.CurrentRow.Selected = false;



  • Binding Data to DataGridView - don't select a row