Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

How to catch "new-row-editing-cancelled" event in DataGridView (is there any similar event?)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Jones - 25 Jul 2006 12:11 GMT
Hi,
I need to know when user cancelled adding a new row to the DataGridView.
Is there a way how to do it? I explored the DataGridView events but
failed to find any usable one.

The thing is I need to do something when user adds a row to the DGV.
This is done in the DGV_UserAddedRow. In case user starts filling one
cell in the NewRow row, UserAddedRow is fired. If he/she decides not to
add this row and cancels it by pressing ESC, the row disappears, but
code in the DGV_UserAddedRow was already executed and I need it to be
undone. How?

Thanks for any help.

With regards
Paul Jones
Jim Wooley - 25 Jul 2006 14:19 GMT
> I need to know when user cancelled adding a new row to the
> DataGridView.
[quoted text clipped - 6 lines]
> but code in the DGV_UserAddedRow was already executed and I need it to
> be undone. How?

You may be able to check the DataGridView.CurrentRow.IsNewRow property and
deal with the bound values appropriately. If using an IBindingList implementation,
you may be able to just call .CancelEdit.
Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
Paul Jones - 25 Jul 2006 14:29 GMT
Hi Jim,
thanks for your reply. I'm afraid this is not what I need. Changes made
in the DGV_UserAddedRow function do not include changes in the DGV.
That's why I need to catch this "new-row-editing-cancelled" to get all
those things to the previous state. Nevertheless, I'll try the
DataGridView.CurrentRow.IsNewRow in UserDeletedRow or RowsDeleted, maybe
it will work.

With regards
Paul Jones

Jim Wooley napsal(a):
>> I need to know when user cancelled adding a new row to the
>> DataGridView.
[quoted text clipped - 12 lines]
> Jim Wooley
> http://devauthority.com/blogs/jwooley/default.aspx

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.