What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Uncommitted new row cannot be deleted. C#

Uncommitted new row cannot be deleted. C#
Author: Message:
MX-G
Full Member
***

Avatar

Posts: 301
Reputation: 22
30 / Male / Flag
Joined: Jun 2006
O.P. Uncommitted new row cannot be deleted. C#
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
06-14-2009 07:52 PM
Profile PM Find Quote Report
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
30 / Male / Flag
Joined: Jun 2006
RE: Uncommitted new row cannot be deleted. C#
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);
}


This post was edited on 06-14-2009 at 08:59 PM by felipEx.
06-14-2009 08:56 PM
Profile E-Mail PM Find Quote Report
MX-G
Full Member
***

Avatar

Posts: 301
Reputation: 22
30 / Male / Flag
Joined: Jun 2006
O.P. RE: Uncommitted new row cannot be deleted. C#
ok, let me try it thanks :)

so i cannot delete it by anyway?

This post was edited on 06-14-2009 at 09:19 PM by MX-G.
06-14-2009 09:11 PM
Profile PM Find Quote Report
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
30 / Male / Flag
Joined: Jun 2006
RE: RE: Uncommitted new row cannot be deleted. C#
quote:
Originally posted by MX-G
so i cannot delete it by anyway?
No, unless you set the AllowUserToAddRows property to false
06-14-2009 09:59 PM
Profile E-Mail PM Find Quote Report
MX-G
Full Member
***

Avatar

Posts: 301
Reputation: 22
30 / Male / Flag
Joined: Jun 2006
O.P. RE: Uncommitted new row cannot be deleted. C#
worked, thanks =D
06-14-2009 10:46 PM
Profile PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6075
Reputation: 57
34 / Male / Flag
Joined: Oct 2003
RE: Uncommitted new row cannot be deleted. C#
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).
[Image: spartaafk.png]
06-23-2009 05:42 PM
Profile PM Web Find Quote Report
robertgalp
New Member
*


Posts: 1
Joined: Apr 2012
RE: Uncommitted new row cannot be deleted. C#
try this link , it may help yo abt datagridview delete.

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

login.
04-19-2012 05:38 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On