Hi guys I searched for lot on this topic but don't get any result. I want to know it is possible to add, update, delete inside datagridview in c# means i want to add new row and data inside the editable datagridview not from the forms control. I want to place Add New, edit, delete button or anything inside datagridview. In google there is lot of tutorials for this but from the form controls. This is possible in gridview control but i want to know this is also possible in datagridview or not If you have any link related to this then plz inform me. Thanks in advance!
0
votes
bind a collection to the itemsource of the grid view. make changes to this collection using your add remove logic. and it will update the data automatically.
- Jay Nirgudkar
Addition to the comment above: Make a collection of class object and your work will get easier.
- jparthj
Can you give me some links or idea how to do it?
- Arvind Gupta
1 Answers
0
votes
You can Add new DataSet to your project, drag into it by DataSet Designer the table that you want edit with DataGridView by drag and drop from the Server Explorer to DataSet Designer, the runtime will create all the action to interact with you Dataset and TableAdapter, back into Form designer open Data Source Panel Drag your table under dataset to your Form .... done!
Next step it will call Update Method by single button here is the code:
this.nameOfYourTableAdapter.Update(this.nameOfYourDataSet.nameOfYourTable);
ref: Microsoft MSDN