Create new record in Datagrid

  • Thread starter Thread starter Grey
  • Start date Start date
G

Grey

The form has two textboxes, one "Add" button and one two columns datagrid. My requirement is when user clicks the "Add" button, there should be a new row created at the last of the datagrid. When user input values in the textboxes, the cells of the newly created row should also be displayed what the user input as the cells are related to the two textboxes.

Is it possible to do that??? If so, how to do that??


Million Thanks.
 
Hi Grey,

You should add a new data row to the data source bound to the grid and
populate the row with the data entered. The grid will then catch up and
display the created row automatically. The only thing here is where the row
will be displayed depends on the sort order you currently have in the grid.
If the sort order is the default one, the row should appear as the last row.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

The form has two textboxes, one "Add" button and one two columns datagrid.
My requirement is when user clicks the "Add" button, there should be a new
row created at the last of the datagrid. When user input values in the
textboxes, the cells of the newly created row should also be displayed what
the user input as the cells are related to the two textboxes.

Is it possible to do that??? If so, how to do that??


Million Thanks.
 
Thank you for your suggestion...But would you kindly provide some sample
code for me...as i am a newcomer of C#..
 
Back
Top