|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to cancel deleting a row in an eventHello
I need an event to be able to cancel a delete request to a DataRow object in some conditions. It seems DataRowDeleting should be able to do the job but setting e.Action is impossible (it is read-only) How can I do the above job? Thanks in advance Hamed I need an event to cancel deletion of a DataGrid row that the DataTable is
bound to. Show quote "Hamed" <ha***@raymehr.com> wrote in message news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... > Hello > > I need an event to be able to cancel a delete request to a DataRow object > in some conditions. It seems DataRowDeleting should be able to do the job > but setting e.Action is impossible (it is read-only) > > How can I do the above job? > > Thanks in advance > Hamed > Hamed,
Reading your question over. Probably is this on our website your answer. http://www.vb-tips.com/dbpages.aspx?ID=740184e1-a6df-4e31-8417-a1741d691945 I hope this helps, Cor Show quote "Hamed" <ha***@raymehr.com> schreef in bericht news:eJchokLWHHA.4028@TK2MSFTNGP04.phx.gbl... >I need an event to cancel deletion of a DataGrid row that the DataTable is > bound to. > > > "Hamed" <ha***@raymehr.com> wrote in message > news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... >> Hello >> >> I need an event to be able to cancel a delete request to a DataRow object >> in some conditions. It seems DataRowDeleting should be able to do the job >> but setting e.Action is impossible (it is read-only) >> >> How can I do the above job? >> >> Thanks in advance >> Hamed >> > > > Thanks Cor but in the code you mentioned if a cell is selected but the whole
row is not selected, it will be deleted that is not a desired occurrence. any other suggestion is appreciated Hamed Show quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%230tuQBMWHHA.2256@TK2MSFTNGP02.phx.gbl... > Hamed, > > Reading your question over. Probably is this on our website your answer. > > http://www.vb-tips.com/dbpages.aspx?ID=740184e1-a6df-4e31-8417-a1741d691945 > > I hope this helps, > > Cor > > "Hamed" <ha***@raymehr.com> schreef in bericht > news:eJchokLWHHA.4028@TK2MSFTNGP04.phx.gbl... >>I need an event to cancel deletion of a DataGrid row that the DataTable is >> bound to. >> >> >> "Hamed" <ha***@raymehr.com> wrote in message >> news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... >>> Hello >>> >>> I need an event to be able to cancel a delete request to a DataRow >>> object >>> in some conditions. It seems DataRowDeleting should be able to do the >>> job >>> but setting e.Action is impossible (it is read-only) >>> >>> How can I do the above job? >>> >>> Thanks in advance >>> Hamed >>> >> >> >> > > I need an event to cancel deletion of a DataGrid row that the DataTable is
bound to. Show quote "Hamed" <ha***@raymehr.com> wrote in message news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... > Hello > > I need an event to be able to cancel a delete request to a DataRow object > in some conditions. It seems DataRowDeleting should be able to do the job > but setting e.Action is impossible (it is read-only) > > How can I do the above job? > > Thanks in advance > Hamed > I need an event to cancel deletion of a DataGrid row that the DataTable is
bound to. Show quote "Hamed" <ha***@raymehr.com> wrote in message news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... > Hello > > I need an event to be able to cancel a delete request to a DataRow object > in some conditions. It seems DataRowDeleting should be able to do the job > but setting e.Action is impossible (it is read-only) > > How can I do the above job? > > Thanks in advance > Hamed > Hamed,
Reading your question over. Probably is this on our website your answer. http://www.vb-tips.com/dbpages.aspx?ID=740184e1-a6df-4e31-8417-a1741d691945 I hope this helps, Cor Show quote "Hamed" <ha***@raymehr.com> schreef in bericht news:eJchokLWHHA.4028@TK2MSFTNGP04.phx.gbl... >I need an event to cancel deletion of a DataGrid row that the DataTable is > bound to. > > > "Hamed" <ha***@raymehr.com> wrote in message > news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... >> Hello >> >> I need an event to be able to cancel a delete request to a DataRow object >> in some conditions. It seems DataRowDeleting should be able to do the job >> but setting e.Action is impossible (it is read-only) >> >> How can I do the above job? >> >> Thanks in advance >> Hamed >> > > > Hamed,
Reading your question over. Probably is this on our website your answer. http://www.vb-tips.com/dbpages.aspx?ID=740184e1-a6df-4e31-8417-a1741d691945 I hope this helps, Cor Show quote "Hamed" <ha***@raymehr.com> schreef in bericht news:eJchokLWHHA.4028@TK2MSFTNGP04.phx.gbl... >I need an event to cancel deletion of a DataGrid row that the DataTable is > bound to. > > > "Hamed" <ha***@raymehr.com> wrote in message > news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... >> Hello >> >> I need an event to be able to cancel a delete request to a DataRow object >> in some conditions. It seems DataRowDeleting should be able to do the job >> but setting e.Action is impossible (it is read-only) >> >> How can I do the above job? >> >> Thanks in advance >> Hamed >> > > > Thanks Cor but in the code you mentioned if a cell is selected but the whole
row is not selected, it will be deleted that is not a desired occurrence. any other suggestion is appreciated Hamed Show quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%230tuQBMWHHA.2256@TK2MSFTNGP02.phx.gbl... > Hamed, > > Reading your question over. Probably is this on our website your answer. > > http://www.vb-tips.com/dbpages.aspx?ID=740184e1-a6df-4e31-8417-a1741d691945 > > I hope this helps, > > Cor > > "Hamed" <ha***@raymehr.com> schreef in bericht > news:eJchokLWHHA.4028@TK2MSFTNGP04.phx.gbl... >>I need an event to cancel deletion of a DataGrid row that the DataTable is >> bound to. >> >> >> "Hamed" <ha***@raymehr.com> wrote in message >> news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... >>> Hello >>> >>> I need an event to be able to cancel a delete request to a DataRow >>> object >>> in some conditions. It seems DataRowDeleting should be able to do the >>> job >>> but setting e.Action is impossible (it is read-only) >>> >>> How can I do the above job? >>> >>> Thanks in advance >>> Hamed >>> >> >> >> > > Thanks Cor but in the code you mentioned if a cell is selected but the whole
row is not selected, it will be deleted that is not a desired occurrence. any other suggestion is appreciated Hamed Show quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%230tuQBMWHHA.2256@TK2MSFTNGP02.phx.gbl... > Hamed, > > Reading your question over. Probably is this on our website your answer. > > http://www.vb-tips.com/dbpages.aspx?ID=740184e1-a6df-4e31-8417-a1741d691945 > > I hope this helps, > > Cor > > "Hamed" <ha***@raymehr.com> schreef in bericht > news:eJchokLWHHA.4028@TK2MSFTNGP04.phx.gbl... >>I need an event to cancel deletion of a DataGrid row that the DataTable is >> bound to. >> >> >> "Hamed" <ha***@raymehr.com> wrote in message >> news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... >>> Hello >>> >>> I need an event to be able to cancel a delete request to a DataRow >>> object >>> in some conditions. It seems DataRowDeleting should be able to do the >>> job >>> but setting e.Action is impossible (it is read-only) >>> >>> How can I do the above job? >>> >>> Thanks in advance >>> Hamed >>> >> >> >> > > Hamed,
Reject changes is fine, not only for deleting. (Be aware that it does not work for removing) http://msdn2.microsoft.com/en-us/library/system.data.datarow.rejectchanges.aspx it is there as well at datatable and dataset level http://msdn2.microsoft.com/en-gb/library/system.data.datatable.rejectchanges.aspx Cor Show quote "Hamed" <ha***@raymehr.com> schreef in bericht news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... > Hello > > I need an event to be able to cancel a delete request to a DataRow object > in some conditions. It seems DataRowDeleting should be able to do the job > but setting e.Action is impossible (it is read-only) > > How can I do the above job? > > Thanks in advance > Hamed > I think that the only way is to throw an exception.
An ugly way btw. -- Show quoteMiha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Hamed" <ha***@raymehr.com> wrote in message news:eP9FYZLWHHA.4764@TK2MSFTNGP05.phx.gbl... > Hello > > I need an event to be able to cancel a delete request to a DataRow object > in some conditions. It seems DataRowDeleting should be able to do the job > but setting e.Action is impossible (it is read-only) > > How can I do the above job? > > Thanks in advance > Hamed > "Miha Markic [MVP C#]" <miha at rthand com> wrote in message I read some threads such as the following but isn't there really a more neat news:OG48U7LWHHA.2256@TK2MSFTNGP02.phx.gbl... >I think that the only way is to throw an exception. > An ugly way btw. > method to do the job? http://groups.google.com/group/microsoft.public.dotnet.framework.windowsforms.databinding/browse_thread/thread/400571e860cdd22a/7fdc4a9383662d26?lnk=st&q=cancel+delete+datagrid+.net&rnum=2#7fdc4a9383662d26 Honestly, I give up on controlling/cancelling row deletion. Instead I don't
allow deletion before it happens.. -- Show quoteMiha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Hamed" <ha***@raymehr.com> wrote in message news:uiBPJSWWHHA.4668@TK2MSFTNGP04.phx.gbl... > > > "Miha Markic [MVP C#]" <miha at rthand com> wrote in message > news:OG48U7LWHHA.2256@TK2MSFTNGP02.phx.gbl... >>I think that the only way is to throw an exception. >> An ugly way btw. >> > > > > I read some threads such as the following but isn't there really a more > neat method to do the job? > > http://groups.google.com/group/microsoft.public.dotnet.framework.windowsforms.databinding/browse_thread/thread/400571e860cdd22a/7fdc4a9383662d26?lnk=st&q=cancel+delete+datagrid+.net&rnum=2#7fdc4a9383662d26 > |
|||||||||||||||||||||||