is it possible to change the position of the blank row at the end of the datagridview to the top of datagrid? RRS feed

  • Question

  •  I want to allow user to add rows but the blank row must be in he first position to let the user enter data without scroll down each time to insert a new row ?!

    This is how I add the rows in the datagridview :

    private readonly DataGridView _dgv; private BindingSource _bindingSource; private DataTable _dataTable; private string _selectQueryString; private SqlConnection _sqlConnection; private SqlDataAdapter _sqlDataAdapter; protected SqlHelper(DataGridView dgv) { _dgv = dgv; } //display a table in datagridview public void ShowTable(String tableName) { _sqlConnection = new SqlConnection(ConnectionString); _sqlConnection.Open(); _selectQueryString = "SELECT * FROM " + tableName; _sqlDataAdapter = new SqlDataAdapter(_selectQueryString, _sqlConnection); var sqlCommandBuilder = new SqlCommandBuilder(_sqlDataAdapter); _dataTable = new DataTable(); _sqlDataAdapter.Fill(_dataTable); _bindingSource = new BindingSource {DataSource = _dataTable}; _dgv.DataSource = _bindingSource; _sqlConnection.Close(); }

    I use winforms ! C# Visual studio 2013

    Monday, March 23, 2015 3:08 AM


All replies