Shoutbox

Uncommitted new row cannot be deleted. C# - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Uncommitted new row cannot be deleted. C# (/showthread.php?tid=91063)

Uncommitted new row cannot be deleted. C# by MX-G on 06-14-2009 at 07:52 PM

I'm trying to delete the latest row in a DataGridView on C# .net and that exception appears, why because????^o)

It only happens with the latest :S


RE: Uncommitted new row cannot be deleted. C# by felipEx on 06-14-2009 at 08:56 PM

Isn't because the latest row is in edit mode (with an asterisk in the first column)? before deleting latest row make sure it's not a new row ;)

C# code:
if (!yourdataGrid.Rows[i].IsNewRow){
   yourdataGrid.Rows.RemoveAt(i);
}

RE: Uncommitted new row cannot be deleted. C# by MX-G on 06-14-2009 at 09:11 PM

ok, let me try it thanks :)

so i cannot delete it by anyway?


RE: RE: Uncommitted new row cannot be deleted. C# by felipEx on 06-14-2009 at 09:59 PM

quote:
Originally posted by MX-G
so i cannot delete it by anyway?
No, unless you set the AllowUserToAddRows property to false
RE: Uncommitted new row cannot be deleted. C# by MX-G on 06-14-2009 at 10:46 PM

worked, thanks =D


RE: Uncommitted new row cannot be deleted. C# by RaceProUK on 06-23-2009 at 05:42 PM

quote:
Originally posted by MX-G
I'm trying to delete the latest row in a DataGridView on C# .net and that exception appears, why because????^o)

It only happens with the latest :S
Alternatively, just call RejectChanges() (it's something like that anyway).
RE: Uncommitted new row cannot be deleted. C# by robertgalp on 04-19-2012 at 05:38 PM

try this link , it may help yo abt datagridview delete.

http://csharp.net-informations.com/datagridview/c...dview-tutorial.htm

login.