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 / February 2007

Tip: Looking for answers? Try searching our database.

How to force DataGridView to add the new (just filled in) row into itself manually? (C#)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nvx - 18 Feb 2007 10:42 GMT
Hi,
I have a DataGridView and a toolbar with buttons. I need to force
DataGridView to validate and add the row user has just filled in
(which is still not the part of the actual DGV.Rows collection, I
guess) to itself after clicking on the toolbar button.

The situation is this:
1. I have a DataGridView, one row (the last) is empty -- for new data
2. I start typing into this empty row, new empty row appears
immediately while the edited row is still not part of the DGV.Rows
collection.
3. I click on the toolbar button and need the edited row to be
validated and, if validation succeeds, added into the DGV.Rows
collection

The problem is the edited row becomes part of the collection after I
click into the new empty row (and maybe after some other events
occur), which is not what happens. Instead, I click on the toolbar
button and it seems like the DGV never even loses focus...

Sorry for this indistinct description...

Any ideas?

TIA

With regards
nvx
ClayB - 18 Feb 2007 15:01 GMT
Try calling

     this.Validate();

at the beginning of your toolbar button handler code to see if that
makes things work the way you want them to.

=====================
Clay Burch
Syncfusion, Inc.
nvx - 18 Feb 2007 15:53 GMT
Thank you very much, it seems to be doing what I need... :)

With regards
nvx

ClayB napsal:
> Try calling
>
[quoted text clipped - 6 lines]
> Clay Burch
> Syncfusion, Inc.

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.