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 Controls / December 2007

Tip: Looking for answers? Try searching our database.

DataGridView - commit a row that is not editted

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hemol - 04 Nov 2007 16:52 GMT
I have a DataGridView which I'm using the DefaultValuesNeeded to populate
every column in a row.

I'm only able to get a new editable row created if I manually edit one of
the cells (as soon as I hit a key in a cell to change the value, a new row
appears which can be clicked on and the DefaultValuesNeeded event get fired
again to populate that row.

Since all the cells have default values, and the user might not want to edit
any of the cells (just accept the default), I want to commit (not sure if
that's the right term)the row as soon as the default values are specified.  
But I can't figure out the right combo of event(s) / method(s) to call to get
the DataGridView to just accept the defaults as a fully entered row of data.

This is a data bound control to a DataTable in a DataSet.

Thanks for any help.
Hemol - 04 Nov 2007 18:04 GMT
Ah, figured it out I think:

In the DefaultValueNeeded event, after setting the values, I'm doing this:

DataGridView dgv = sender as DataGridView;
dgv.BindingContext[dgv.DataSource, dgv.DataMember].EndCurrentEdit();

> I have a DataGridView which I'm using the DefaultValuesNeeded to populate
> every column in a row.
[quoted text clipped - 13 lines]
>
> Thanks for any help.
Shawn.KL.Tucker@gmail.com - 19 Dec 2007 22:45 GMT
> Ah, figured it out I think:
>
[quoted text clipped - 22 lines]
>
> - Show quoted text -

This does the same thing as DataGridView.EndEdit();

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.