The simpler way I could think of is, while populating the grid, ill see how many existing rows I am adding from DB. Ill keep a count on it. Then when user clicks save, ill update the DB from rows after this count.
Once update the DB, ill update the count to new rows count. The same holds good even if you don't want to allow the user to edit, you can write events where you can check if the editable row is less than tis count, then disallow him to edit.
How do you update the db rows with da. Update(dt) "after this count"? Is there a way to only "partially" update?
– Dgloria Aug 18 at 8:38 Just take away the rows which you want to update into db from grid and then pass them either to a stored proc or iterate over the rows if your doing via insert query. DB insertion, you can use SqlConnection and SqlCommand classes. Please google, there alot of links youll get.
– zenwalker Aug 18 at 8:42.
As an alternative you could provide the user with a new Form in order for them to add a new record like a lot of new forms. I liked the idea of a user being able to add a row to a DataGridView but in the end gave up fighting with it. You just have far easier control in a Form as opposed to a row in a DGV.In answer to your question - Rather than fight the source, perhaps ask the DataGridView to officiate: dataGridView1.
DataSource = bs; dataGridView1. ReadOnly = true; dataGridView1. CurrentCellChanged += delegate { DataGridViewRow row = dataGridView1.
CurrentRow; bool readOnly = row == null || row. Index! = dataGridView1.
NewRowIndex; dataGridView1. ReadOnly = readOnly; }; (and don't set AllowEdit on the list) Source: C# WinForms BindingList & DataGridView - disallowing EDIT prevents creation of a NEW row? How can I address this?
Amazing, I would never find that out myself. :) Somehow this works only for the first column, the second column is not accessible. Can U help please?
– Dgloria Aug 18 at 10:18 Sorry can you expand that? – CodeBlend Aug 18 at 10:32.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.